2

I'm developping application with JOGL2 and my favorite IDE Eclipse, also I want to use Maven2 for this purpose. Unfortunately, JOGL2 has no artifact yet. Also, I plan to deploy it as a runnable jar file.

So I want to install JOGL artifact locally : so i'll use the install:install-file command.

But I want to group several jars to make several artifacts, that is :

  • gluegen-rt.jar and jogl.all.jar as a single artifact named jogl.core
  • gluegen-rt-natives-linux-i586.jar and jogl.all-natives-linux-i586.jar as a single jar named jogl-natives-linux-i586
  • and so on

Is it possible ? (The official documentation does not mention the possibility or unpossibility to do so).

Thanks in advance

loloof64
  • 5,252
  • 12
  • 41
  • 78

2 Answers2

3

Install all files as usual like file:jar:version. Than create pom with pom packaging and use gluegen-rt.jar and jogl.all.jar as dependencies in it (they must be already installed). After that use new pom as dependency in your project.

madhead
  • 31,729
  • 16
  • 153
  • 201
  • 1
    +1, OP asks for a single JAR, but your suggestion is actually better – Tomasz Nurkiewicz Sep 29 '12 at 21:05
  • Thank you :) Looks quite promising : but I don't understand procedure of the second sentence. Please, tell me more. – loloof64 Sep 29 '12 at 21:07
  • http://stackoverflow.com/questions/7692161/what-is-pom-packaging-in-maven http://stackoverflow.com/questions/7075285/why-maven-compilation-doesnt-work-with-pom-packaging-type – madhead Sep 29 '12 at 21:11
  • 1
    1. Install your files as usual `mvn install:install-file -Dfile= -DgroupId= -DartifactId= -Dversion= -Dpackaging=jar` 2. Create new pom.xml, with: `groupId=jogl`, `artifactId=core`, `version=1.0-MY-CUSTOM-JOGL`, `packaging=pom` (for example) 3. Add dependencies to this pom in `dependencies` section 4. Run `mvn clean install` in directory with new pom 5. Use dependency `jogl:core:1.0-MY-CUSTOM-JOGL` in your project 6. Should work :), i'm writing by memory, but the idea is that. – madhead Sep 29 '12 at 21:16
  • 1
    This will still bring in your two jars as separate. If you want to create a single jar do what madhead suggests but switch the packaging to jar and use the maven assembly plugin to generate the combined artifact. – Adam B Oct 02 '12 at 02:15
2

maven doesn't have support for that. You would have to unpack these JAR files and repackage them together.

maven does have support for merging JAR with dependencies (http://stackoverflow.com/questions/574594) - and it's done the way I mentioned above. But you are asking about merging two arbitrary JARs, which is not possible in maven.

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674