Netbeans Maven项目不添加主类到清单 [英] Netbeans Maven Project Not adding Main Class to Manifest
问题描述
我有类似的问题,这个问题。我已经尝试了所有列出的建议,但仍然是亏损。我的问题是,我正在尝试构建一个maven项目并将其分发到其他机器,但是jar文件没有被正确的清单填充。每次我构建和运行我得到以下错误: no main manifest属性,在myjar.jar
中。是否有某种配置文件需要编辑?我只是不知道发生了什么。我试图这个
I am having a similar problem to this question. I have tried all the suggestions listed and am still at a loss. My issue is that I am trying to build a maven project and distribute it to other machines, but the jar files are not being populated with a correct Manifest. Each time I build and run I get the following error: no main manifest attribute, in myjar.jar
. Is there some sort of configuration file I need to edit? I just don't know what is going on. I have attempted this fix also, but to no avail.
推荐答案
您可以将其添加到项目的pom文件中,< project>
标签:
You can add it into project's pom file, inside <project>
tag:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>your.main.class</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
这篇关于Netbeans Maven项目不添加主类到清单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!