IntelliJ: Including cans in a gang artifact

Developing on Mac with IntelliJ 9.0.2 Community Edition.

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

However, if I get a list of the jar file being generated, it looks like this:

  com / acme / myclass 1.class
  com / acme / myclass 2.class
  ...
  mylib1.jar
  myLib2.jar

And no surprises, if I double clicked on the jar file it gets a NoClassDefFoundError the first time I try to access a class in a particular library jar.

I seem to need to tell IntelliJ to "embed" library jars - but this menu item is always greyed out!

Does anyone have any ideas how to get bans embedded in an artifact in a bank?

+2


a source to share


3 answers


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



If you would like this feature to appear in future versions of IDEA, please vote on the request .

+2


a source


Having the JAR dependencies included in your JAR should run the yoru code successfully. You probably don't have a JAR in your classpath.



0


a source


I will be using the Maven Assembly plugin. Its simple and will give you a neat little jar file.

0


a source







All Articles