IntelliJ IDEA中错误的Manifest.mf创建.jar [英] Wrong Manifest.mf in IntelliJ IDEA created .jar

查看:2246
本文介绍了IntelliJ IDEA中错误的Manifest.mf创建.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用OptaPlanner 6.0.1库将项目打包到.jar中,通过IntelliJ IDEA的jar工件,而不是我的manifest.mf包含标准

I'm trying to package a project using OptaPlanner 6.0.1 libraries into a .jar through IntelliJ IDEA's jar artifact but instead of my manifest.mf containing the standard

Manifest-Version: 1.0
Main-Class: a.b.c.app

jar使用的是ecta-3.7.2.jar中提供的一个,这是OptaPlanner的支持库之一:

the jar uses the one supplied in ecj-3.7.2.jar, one of OptaPlanner's supporting libraries:

Manifest-Version: 1.0
Build-Jdk: 1.6.0_26
Built-By: ibrandt
Created-By: Apache Maven
Archiver-Version: Plexus Archiver

因此,appname.jar中的无主要清单属性尝试运行应用程序时发生错误。如果我手动将.jar文件中的清单替换为我的一切正常。我有什么办法可以解决这个问题吗?

Because of this, a "no main manifest attribute, in appname.jar" error happens when trying to run the app. If I manually replace the manifest in .jar file with mine everything works correctly. Is there anything I can do to fix this?

我将库保存在一个单独的/ lib目录中,并将它们作为Extracted Directory,IntelliJ添加到jar工件的根目录中IDEA是v13.0.1。

I keep the libraries in a separate /lib directory and they were added to the root of jar artifact as Extracted Directory, IntelliJ IDEA is v13.0.1.

推荐答案

我遇到了同样的问题。

确保您的MANIFEST.MF位于:

Make sure your MANIFEST.MF is in:

src/main/resources/META_INF/

NOT

src/main/java/META_INF/

这篇关于IntelliJ IDEA中错误的Manifest.mf创建.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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