要创建一个可执行的jar,我们需要添加spring-boot-maven-plugin到我们的 pom.xml。为此,请在该dependencies部分正下方插入以下几行:

要创建一个可执行的jar,我们需要添加spring-boot-maven-plugin到我们的 pom.xml为此,请在该dependencies部分正下方插入以下几行

1 <build> 
2     <plugins> 
3         <plugin> 
4             <groupId> org.springframework.boot </ groupId> 
5             <artifactId> spring-boot-maven-plugin </ artifactId> 
6         </ plugin> 
7     </ plugins> 
8 </ build>

 

不是每个人都喜欢从spring-boot-starter-parentPOM 继承你可能有你自己的企业标准的父母,你需要使用或者你可能更喜欢显式声明所有的Maven配置。

如果你不想使用它spring-boot-starter-parent,你仍然可以通过使用一个scope=import依赖来保持依赖管理(而不是插件管理)的好处 ,如下所示:

 1 <dependencyManagement>
 2         <dependencies>
 3         <dependency>
 4             <!-- Import dependency management from Spring Boot -->
 5             <groupId>org.springframework.boot</groupId>
 6             <artifactId>spring-boot-dependencies</artifactId>
 7             <version>2.0.0.BUILD-SNAPSHOT</version>
 8             <type>pom</type>
 9             <scope>import</scope>
10         </dependency>
11     </dependencies>
12 </dependencyManagement>

 

posted @ 2017-12-12 11:45  yhjjgj  阅读(1267)  评论(0编辑  收藏  举报