Friday, June 17, 2016

How to download latest snapshot from maven repository

Previously I had problem to download latest snapshot build from maven repository. It's not about copying file from maven repository home ~/.m2/repository/. It's just part of process. First it's necessary to download latest build from maven repository. Easiest way is to push maven to do it. For example let's have package com.example:billing:1.0.0-SNAPSHOT:war. Command will look like:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get --batch-mode -Dmdep.useBaseVersion=true -Dartifact=com.example:billing:1.0.0-SNAPSHOT:war -DremoteRepositories=example-snapshots::default::http://companynexus.com/nexus/content/repositories/snapshots/

Detail description can by found at http://maven.apache.org/plugins/maven-dependency-plugin/get-mojo.html.

Copy snapshot artifact from local repository can by done like this:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:copy -Dmdep.useBaseVersion=true -DoutputDirectory=/opt/billing/ -Dartifact=com.example:billing:1.0.0-SNAPSHOT:war
Description can be found at http://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html.

No comments:

Post a Comment