Server公共模块打包Unable to find main class
时间: 2023-10-14 17:04:35 浏览: 88
Could not find the main class
在使用Maven聚合工程进行打包时,如果在打包Server公共模块时报错"Unable to find main class",这可能是因为在该模块中没有配置主入口类。根据引用中的解决方案,你可以在common模块的pom.xml文件中添加如下配置,来解决这个问题。具体的解决方案如下所示:
在common模块的pom.xml文件中添加以下配置:
```xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<mainClass><!-- 这里填写你的主入口类 --></mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
```
通过添加这个配置,你可以指定具体的主入口类来解决"Unable to find main class"的问题。记得将`<mainClass>`中的注释替换为你的主入口类的全限定名。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Maven项目打包报错:Unable to find main class](https://blog.csdn.net/m0_63926154/article/details/126926074)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [spring boot maven多模块打包Unable to find main class问题](https://blog.csdn.net/kaichekaihanma/article/details/123252611)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文