no main manifest attribute
一个主项目下,多个业务模块,假设 starter 模块作为启动器,以及主项目(project)最外层父 pom.xml

- <build>
- <plugins>
- <plugin>
- <groupId>org.springframework.bootgroupId>
- <artifactId>spring-boot-maven-pluginartifactId>
- <configuration>
- <includeSystemScope>trueincludeSystemScope>
- configuration>
- plugin>
- plugins>
- build>
其实 starter - pom.xml 写上这个就亲测有效,如何验证呢?!
- Manifest-Version: 1.0
- Implementation-Title: szqy-starter
- Implementation-Version: 0.0.1-SNAPSHOT
- Start-Class: com.szqy.starter.SzqyStarterApplication
- Spring-Boot-Classes: BOOT-INF/classes/
- Spring-Boot-Lib: BOOT-INF/lib/
- Build-Jdk-Spec: 1.8
- Spring-Boot-Version: 2.1.18.RELEASE
- Created-By: Maven Archiver 3.4.0
- Main-Class: org.springframework.boot.loader.JarLauncher
但是为什么还要在 project - pom.xml 加插件,是因为这项目用了 mapstruct,需要对它和 lombok 做一些处理。当然如果没这个需求,我觉得可以不用加这段,理论上也可以启动成功!
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-compiler-pluginartifactId>
- <version>3.8.1version>
- <configuration>
- <source>8source>
- <target>8target>
- <encoding>UTF-8encoding>
- <annotationProcessorPaths>
- <path>
- <groupId>org.mapstructgroupId>
- <artifactId>mapstruct-processorartifactId>
- <version>1.4.1.Finalversion>
- path>
- <path>
- <groupId>org.projectlombokgroupId>
- <artifactId>lombokartifactId>
- <version>1.18.12version>
- path>
- annotationProcessorPaths>
- configuration>
- plugin>
- plugins>
- build>