maven学习一

关于springboot的pom文件必须项,在https://projects.spring.io/spring-boot/的网站上的

Quick Start是这样写的

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

估计是为了让大家很快上手,但是问题马上就来了,如何发布呀

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>

</build>

这就是必须的了,这个是使用java -jar的方式执行时需要的。

<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!--jetty 插件,mvn jetty:run -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
<configuration>
<webApp>
<contextPath>/</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webApp>
<stopKey>exit</stopKey>
<stopPort>9091</stopPort>
<webAppSourceDirectory>${project.basedir}/src/main/webapp</webAppSourceDirectory>
<scanIntervalSeconds>0</scanIntervalSeconds>
<httpConnector>
<port>8087</port>
</httpConnector>
</configuration>
</plugin>
<!-- tomcat 插件,mvn tomcat:run -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<path>/</path>
<port>8080</port>
<uriEncoding>UTF-8</uriEncoding>
<warFile>${project.build.directory}/${project.build.finalName}.war</warFile>
</configuration>
</plugin>

</plugins>

这两个选择其中之一就行,是maven的发布方式。还有进入pom文件的目录输入 mvn spring-boot:run启动,此命令是利用spring boot框架内置的tomcat运行spring boot开发的web应用。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值