Maven集成 springboot 有两种方式

文章来源:https://www.cnblogs.com/cxygg/p/9559618.html

1 直接 父项目指向  springboot 

1     <parent>
2         <groupId>org.springframework.boot</groupId>
3         <artifactId>spring-boot-starter-parent</artifactId>
4         <version>2.0.3.RELEASE</version>
5     </parent>

这种用起来很方便 ,默认打出的jar 也是完整的。

使用  spring-boot-dependencie 

 1 <!-- springcloud -->
 2     <dependencyManagement>
 3         <dependencies>
 4             <dependency>
 5                 <groupId>org.springframework.boot</groupId>
 6                 <artifactId>spring-boot-dependencies</artifactId>
 7                 <version>2.0.3.RELEASE</version>
 8                 <type>pom</type>
 9                 <scope>import</scope>
10             </dependency>
11         </dependencies>
12     </dependencyManagement>

这种默认打出的jar包是不完整的。 不能直接运行。

加入下面的配置就可以了

 1 <build>
 2     <plugins>
 3         <plugin>
 4             <groupId>org.springframework.boot</groupId>
 5             <artifactId>spring-boot-maven-plugin</artifactId>
 6             <configuration>
 7                 <mainClass>com.sbl.pay.subaccount.SubaccountServerRunner</mainClass>
 8             </configuration>
 9             <executions>
10                 <execution>
11                     <goals>
12                         <goal>repackage</goal>
13                     </goals>
14                 </execution>
15             </executions>
16         </plugin>
17     </plugins>
18 </build>

第二种麻烦一点,但是我们可以使用自己的父类。

posted @ 2019-07-27 21:00  WuHJ  阅读(162)  评论(0编辑  收藏  举报