使用Maven打包SprintBoot后,运行其应用程序提示没有主清单属性
。
由于我的父pom里面是通过以下去管理版本的。
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
此时会遇到一个问题,打包完成,子模块的jar无法直接运行,原因就是因为这钟管理依赖的方式导致的。
解决办法:
1. 使用spring-boot-starter-parent
这个父pom。
2. 修改子模块spring-boot-maven-plugin
的内容为:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.3.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
[wp-review]