Netbeans Maven 项目未将主类添加到清单 [英] Netbeans Maven Project Not adding Main Class to Manifest

查看:22
本文介绍了Netbeans Maven 项目未将主类添加到清单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了与这个问题类似的问题.我已经尝试了列出的所有建议,但仍然不知所措.我的问题是我正在尝试构建一个 Maven 项目并将其分发到其他机器,但是 jar 文件没有填充正确的 Manifest.每次构建和运行时,我都会收到以下错误:no main manifest attribute, in 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文件中,在标签内:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆