Reputation: 191
I am attempting to take an existing Eclipse project and add a pom.xml so that I can use Maven for automated builds. In the project I have a jar file in the Referenced Libraries that is not in the Maven repository. What do I need to do in order to get Maven to recognize the jar file?
I have sort of fumbled around with the element without any success.
Windows XP, Eclipse 3.6.1, Maven 3.0.2
Upvotes: 2
Views: 11739
Reputation: 10331
You can also import the jar into your maven repo using m2e if you're on eclipse indigo. Go to file/import/maven/install or deploy an artifact to a maven repository
You will need just to fill up the group and artifact id
Upvotes: 2
Reputation: 55856
In your pom.xml add a <dependencies>
tag and add all the Jars dependencies in that. It will be downloaded at the time of build.
like this
<project>
...
<dependencies>
<dependency>
<groupId>group-a</groupId>
<artifactId>artifact-a</artifactId>
<version>2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>group-a</groupId>
<artifactId>artifact-b</artifactId>
<version>1.0</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
</dependencies>
....
</project>
see more here http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
For publicly available Jars you can search the dependencies here http://mvnrepository.com/
For the Jars that are not publically available you can install locally, by
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
I am not sure how to install third party jars from inside the Eclipse. There must be some way using m2eclipse plugin.
Upvotes: 4