Spring boot(1)之打包运行

1、问题:Unable to find a single main class

命令:spring-boot:run
结果:Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.1.RELEASE:run (default-cli) on project springboot-test: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:1.4.1.RELEASE:run failed: Unable to find a single main class from the following candidates [com.wjc.HelloWorldConfiguration, com.wjc.App] -> [Help 1]

解决:查看提示的两个类,发现均有main方法,去掉一个多余的main方法,保留一个main方法即可。

2、问题:xxx.jar中没有主清单属性 

命令:java -jar target/springboot-test-1.0-SNAPSHOT.jar
结果:target/springboot-test-1.0-SNAPSHOT.jar中没有主清单属性

解决:查找资料发现MAVEN插件打包生成的jar包中的META-INF/MANIFEST.MF文件,没有设置主函数信息。配置pom.xml即可;

<plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

 

转载于:https://my.oschina.net/wjcinfo/blog/760826

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值