maven打包repackage failed: Unable to find main class

一、Maven打包Spring Boot项目报错(repackage failed: Unable to find main class),排除寻找Main方法,一般用于被依赖的公用常量模块,解决方法如下:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-maven-pluginartifactId>
            <configuration>
                <mainClass>nonemainClass>     
                <classifier>executeclassifier>    
            configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackagegoal>
                    goals>
                execution>
            executions>
        plugin>
    plugins>
build>

二、其他服务模块可以正常配置打包插件如下:

<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.bootgroupId>
      <artifactId>spring-boot-maven-pluginartifactId>
    plugin>
  plugins>
build>

感谢原作者:拄杖忙学轻声码
链接:https://www.jianshu.com/p/0b763cfb92b5
来源:简书

你可能感兴趣的:(maven,后端,maven,java,spring,boot)