2

使用Spring boot + maven模式进行开发,执行maven命令中的package还是install,都会出现以下异常

命令:

mvn clean package -Dmaven.test.skip=true

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage (default) on project renpro: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:repackage failed: Unable to find a single main class from the following candidates [com.ren.RenProApplication, com.ren.util.StrMd5] -> [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

错误原因:原来这个错误是因为maven在执行打包的时候会查找项目中的main方法,并设置为Spring boot 生成jar包的启动入口,但此时有多个main方法,maven插件就无所适从了。因此出现此异常。

因此,注释掉其他无用的main方法即可解决此问题。


asoren
404 声望15 粉丝