IntelliJ:在jar工件中包含jar [英] IntelliJ: Including jars in a jar artifact

查看:166
本文介绍了IntelliJ:在jar工件中包含jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用IntelliJ 9.0.2社区版在Mac上进行开发。

Developing on the Mac with IntelliJ 9.0.2 Community Edition.

我有一个依赖于两个库jar的程序。我已经想出如何让IntelliJ让我成为我的源代码(使用Artifact选项卡),甚至包含两个罐子。

I have a program which depends on two library jars. I have figured out how to get IntelliJ to make me a jar of my source (with the Artifact tab), and even to include the two jars in it.

但是,如果我得到它生成的jar文件的列表,它看起来像这样:


com / acme / MyClass1.class

com / acme / MyClass2.class

...

mylib1.jar

myLib2.jar

However, if I get a listing of the jar file it produces, it looks like this:

com/acme/MyClass1.class
com/acme/MyClass2.class
...
mylib1.jar
myLib2.jar

而且,如果我双击,也不会有任何意外jar文件,它第一次尝试访问一个或其他库jar中的类时会得到一个NoClassDefFoundError。

And, no surprises, if I double-click the jar file, it gets a NoClassDefFoundError the first time it tries to access a class in one or other library jar.

我似乎需要告诉IntelliJ内联图书馆的罐子 - 但这个菜单选项总是灰色的!

It seems I need to tell IntelliJ to "inline" the library jars -- but this menu option is always greyed out!

有没有人知道如何在jar工件中内嵌罐子?

Does anyone have any idea how to get jars inlined in a jar artifact?

推荐答案

IDEA尚不支持它,您可以使用Ant集成来打包您的jar(通过将所有jar解压缩到temp文件夹然后打包项目输出加上这个临时文件夹i单个jar或使用一些Ant任务,如 jarjar )。

IDEA doesn't support it yet, you can use Ant integration to package your jar (either by unpacking all the jars into the temp folder and then packaging the project output plus this temp folder into the single jar or by using some Ant task like jarjar).

如果您希望此功能出现在未来的IDEA版本中,请投票支持请求

If you want this feature to appear in the future IDEA versions, please vote for the request.

这篇关于IntelliJ:在jar工件中包含jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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