码迷,mamicode.com
首页 > 其他好文 > 详细

repackage failed: Unable to find main class

时间:2018-12-10 14:21:36      阅读:443      评论:0      收藏:0      [点我收藏+]

标签:load   解决   plugin   错误信息   one   test   添加   splay   错误   

一.错误信息
SpringBoot进行Maven install操作时报repackage failed: Unable to find main class -> [Help 1]的错误,信息如下

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:repackage (default) on project qfxSpringbootReadPropertiesDemo: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:repackage failed: Unable to find main class -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

二.错误原因
因为没有正式环境的入口类,项目结构如下:

技术分享图片
pom.xml文件的<build>配置信息如下:

技术分享图片

三.解决方案1
pom.xml文件的<build>中指定入口类,代码如下

<configuration>
        <mainClass>com.qfx.App</mainClass>
</configuration>

如图

技术分享图片

四.解决方案2
去掉<build>配置信息中spring热部署的配置,如图

技术分享图片

五.解决方案3
修改pom.xml配置文件<build>内容如下,添加一个<pluginManagement>标签,代码如下

    <build>
        <finalName>test</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <dependencies>
                        <!-- spring热部署 -->
                        <dependency>
                            <groupId>org.springframework</groupId>
                            <artifactId>springloaded</artifactId>
                            <version>1.2.8.RELEASE</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

六.再次执行 Maven install,一切正常

repackage failed: Unable to find main class

标签:load   解决   plugin   错误信息   one   test   添加   splay   错误   

原文地址:http://blog.51cto.com/1197822/2328282

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!