Meaningless Drivel is fun!*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven - Extract a jar from a zip file, and then use it for compile/build. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven - Extract a jar from a zip file, and then use it for compile/build." Watch "Maven - Extract a jar from a zip file, and then use it for compile/build." New topic
Author

Maven - Extract a jar from a zip file, and then use it for compile/build.

Gaurav Upadhyay
Greenhorn

Joined: Oct 11, 2012
Posts: 10
Greetings,

I have the following scenario :

1) A .rar file that contains jar files, and some of these jars i need to build my project with. The rar file is setup in the remote repository.
2) As a part of the Maven build, I need to extract the .rar file, place the contained jars at some location, and then use these jars to compile the project. There are other <dependencies> mentioned in the pom, and these jars should also be used with them while compiling.
3) I used the maven-dependency-plugin to extract the jars from the .rar, to the project build directory, but cannot get Maven to pick them up as dependencies while compiling (even system scope fails).

Please suggest on how to do extract from the rar, take the jars and use them to build, all in the same maven build.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Try the addjars plugin: http://code.google.com/p/addjars-maven-plugin/

Personally, I would extract the JARs from the RAR and load them into the remote repository and then reference them as dependencies. If the problem with that is that you are getting an update RAR almost daily from another team, then you can either tell them to also include the JARs in the repository when they do their build (its easy to do using the build-helper:attach-artifact goal - http://mojo.codehaus.org/build-helper-maven-plugin/attach-artifact-mojo.html), or you can create a separate POM that does the JAR extract just like you are doing now and then load the JARs into the repository. Heck, you could even do that in the same POM as for your build, placing the JARs in the local repository and using them from there. That would even work within a Hudson build slave.


JBoss In Action
 
Don't get me started about those stupid light bulbs.
 
subject: Maven - Extract a jar from a zip file, and then use it for compile/build.
 
Similar Threads
Eclipse - deploying external jars - how to?
Maven Archetypes, eclipse and hibernate
Is there a way to publish maven artifacts to nexus repository using a Fusion Job?
Packaging an entire application in one JAR file
Maven build dependencies from .classpath