添加了spring-boot-maven-plugin插件后,當運行maven打包的命令,項目會被打包成一個可以直接運行的jar包,使用"java -jar"可以直接運行。
maven-jar-plugin,?
當項目中有兩個啟動類時,需要制定要執行的類,如果不指定,啟動會報錯。
maven spring 版本??
指定啟動類有兩種情況需要區分
maven啟動springboot。?
一: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>
?