Thursday, July 18, 2013

Download a library from maven manually

There are times when you want to manually download a maven library using command line then use the local version in your pom file.

First you can download a library from maven using the following command. For example the following mvn command downloads a a library from maven and installs it in your local maven repo.


mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -Dartifact=org.springframework:spring-instrument:3.1.1.RELEASE -DrepoUrl=repository.sonatype.org/content/repositories/central

or something like so

mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get  -Dartifact=com.restfuse:com.eclipsesource.restfuse:1.2.0 -DrepoUrl=repository.sonatype.org/content/repositories/central


Then in your maven config you can add the following snippit in your pom. 

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-instrument</artifactId>
    <version>3.1.1</version>
   <!--Optionally if you downloaded it to some non-standard folder    
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/spring-instrument-3.1.1.jar</systemPath>
   -->
</dependency>









No comments:

Post a Comment