spring-boot-maven-plugin 插件的作用详解
作者:撸码识途
添加了spring-boot-maven-plugin插件后,当运行maven打包的命令,项目会被打包成一个可以直接运行的jar包,使用"java -jar"可以直接运行。这篇文章主要给大家介绍spring-boot-maven-plugin 插件的作用,感兴趣的朋友一起看看吧
添加了spring-boot-maven-plugin插件后,当运行maven打包的命令,项目会被打包成一个可以直接运行的jar包,使用"java -jar"可以直接运行。
当项目中有两个启动类时,需要制定要执行的类,如果不指定,启动会报错。
指定启动类有两种情况需要区分
一:pom文件继承自spring-boot-starter-parent
<properties> <start-class>com.xx.xx</start-class> </properties>
二:pom文件不是继承自spring-boot-starter-parent
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.5.RELEASE</version>
<configuration>
<mainClass>com.xx.xx</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
总结
以上所述是小编给大家介绍的spring-boot-maven-plugin 插件的作用,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!
您可能感兴趣的文章:
- spring-boot-maven-plugin引入出现爆红(已解决)
- Springboot的spring-boot-maven-plugin导入失败的解决方案
- spring-boot-maven-plugin报红解决方案(亲测有效)
- spring-boot-maven-plugin 配置有啥用
- spring-boot-maven-plugin:打包时排除provided依赖问题
- 解决spring-boot-maven-plugin报红的问题
- SpringBoot中的maven插件spring-boot-maven-plugin使用
- SpringBoot Maven打包插件spring-boot-maven-plugin无法解析原因
