运行java -jar时无法加载Main-Class清单属性 [英] Failed to load Main-Class manifest attribute while running java -jar
本文介绍了运行java -jar时无法加载Main-Class清单属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通过遵循本教程<<,我已经成功地使用mvn clean package
构建了Spring MVC项目. /a>.
I have successfully built my Spring MVC project with mvn clean package
by following this tutorial.
现在,我正在尝试通过以下方式运行服务:
Now I am trying to run the service with:
mvn clean package && java -jar target/gs-serving-web-content-0.1.0.jar
但是我得到这个错误:
无法从中加载Main-Class清单属性 target/gs-serving-web-content-0.1.0.jar
Failed to load Main-Class manifest attribute from target/gs-serving-web-content-0.1.0.jar
我想念什么吗?
推荐答案
如果您正在使用Spring Boot,这将解决您的问题:
If you are working with Spring Boot this will solve your problem:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.2.5.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
这篇关于运行java -jar时无法加载Main-Class清单属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文