添加了spring-boot-maven-plugin插件后,当运行maven打包的命令,项目会被打包成一个可以直接运行的jar包,使用“java jar”可以直接运行。
当项目中有两个启动类时,需要制定要执行的类,如果不指定,启动会报错。
指定启动类有两种情况需要区分
<强>一:pom文件继承自spring-boot-starter-parent 强>
& lt; properties> & lt; start-class> com.xx.xx & lt;/properties>
<强>二:pom文件不是继承自spring-boot-starter-parent 强>
& lt; build> & lt; plugins> & lt; plugin> & lt; groupId> org.springframework.boot & lt; artifactId> spring-boot-maven-plugin & lt; version> 2.0.5.RELEASE & lt; configuration> & lt; mainClass> com.xx.xx & lt;/configuration> & lt; executions> & lt; execution> & lt; goals> & lt; goal> repackage & lt;/goals> & lt;/execution> & lt;/executions> & lt;/plugin> & lt;/plugins> & lt;/build>
以上所述是小编给大家介绍的spring-boot-maven-plugin插件的作用,希望对大家有所帮助,如果大家有任何疑问欢迎给我留的言,小编会及时回复大家的!