我有一个Maven Spring Boot Micro Services Java项目,它被安排成一个父模块和6个子模块。在父pom.xml中,我在构建/插件部分包含了Maven Spring Boot插件:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.5.RELEASE</version>
</plugin>我的6个子模块中有5个是微服务,当我运行mvn clean install时,上面的插件可以确保这些被构建到可执行的Spring Boot jars中,包括所有依赖项
但是,另一个子模块只是一个标准的Java实用程序项目,没有Spring Boot上下文。当我尝试构建时,我看到以下错误:
Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.5.RELEASE:repackage failed: Unable to find main class -> [Help 1]这是意料之中的,因为此子模块不是Spring Boot应用程序,也没有主类。我试图通过覆盖该子模块的pom文件中的Spring Boot Maven插件来修复此问题,以便将其视为标准的“瘦”jar:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<!-- The following enables the "thin jar" deployment option. -->
<!-- This creates a normal jar, not an executable springboot jar -->
<dependency>
<groupId>org.springframework.boot.experimental</groupId>
<artifactId>spring-boot-thin-layout</artifactId>
<version>1.0.11.RELEASE</version>
</dependency>
</dependencies>
</plugin>然而,我仍然在我的Maven构建中看到完全相同的错误。我将非常感谢任何关于这一点的提示或指示。
发布于 2020-07-30 20:06:39
您可以通过覆盖实用程序模块中的配置来跳过重新打包插件的执行。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>https://stackoverflow.com/questions/63172113
复制相似问题