Maven - Extract a jar from a zip file, and then use it for compile/build.
posted 3 years ago
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.
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.