I have a bunch of projects which are dependant on a set of commercial 3rd party libraries. We currently don't have a company repository so I have to install the libraries in my own local repo.
Running mvn install:installFile -Dpackaging=jar -Dfile=<file> -DgroupId=<groupId> -DartifactId=<artifactId> -Dversion=<version>
for each file is rather tedious. Could create a bat file, but is there a way to do this using maven?
I'm thinking a project for all the jars and a single pom file with all the group ids, artifact ids, versions and filenames and then the possibility of just running mvn install
in that project, or something along those lines.
Is anything like this possible?
Note: I'm using Maven 3, but a Maven 2 compatible solution would be nice too.
Recently discovered a new solution to this. Basically you can create a local repository within the project which can be checked in with the rest of the source code. Blogged about it here: http://www.geekality.net/?p=2376.
The gist is to deploy dependencies to a folder in your project.
mvn deploy:deploy-file
-Durl=file:///dev/project/repo/
-Dfile=somelib-1.0.jar
-DgroupId=com.example
-DartifactId=somelib
-Dpackaging=jar
-Dversion=1.0
And then simply let Maven know about it and use dependency declarations as normal through your pom.xml
.
<repositories>
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/repo</url>
</repository>
</repositories>
<dependency>
<groupId>com.example</groupId>
<artifactId>somelib</artifactId>
<version>1.0</version>
</dependency>
Not extremely Maven'y, but it works and moving the dependencies to a company repository later should be quite simple.