spring cloud 项目新建的modle,打包时报错找不到主类Unable to find main class

现象:Unable to find main class 

 Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:repackage (default) on project spring-cloud-kubeedge-core: Execution default of goal org.springframework.boot:s
pring-boot-maven-plugin:2.0.4.RELEASE:repackage failed: Unable to find main class 

改进:

pom文件中加入:

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中 -->
                        </goals>
                        <phase>none</phase>
                        <!--可以生成不含依赖包的不可执行Jar包 -->
                        <configuration> <classifier>exec</classifier> </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

 这里的重点是<phase>none</phase>

发布了85 篇原创文章 · 获赞 21 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/weixin_41670928/article/details/103494327