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

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

问题描述

我正在尝试通过 IntelliJ IDEA 的 jar 工件将使用 OptaPlanner 6.0.1 库的项目打包到 .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 使用 ecj-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

因此,在尝试运行应用程序时会发生 no main manifest attribute, in 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 目录中,并将它们作为提取目录添加到 jar 工件的根目录中,IntelliJ 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/

不是

src/main/java/META_INF/

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

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