As part of an automated deployment I need a script to download the latest version of an artifact from our internal repository.
Ideally this script will be with ant or a unix shell script.
So for example:
I have myArtifact.war and it has versions 1.0 , 1.1 and 2.0 - I need the script given the correct group id and artifact id to retrieve version 2.0 from our maven repository (currently using artifactory).
Is there any easy way to do this?
versions:use-latest-versions searches the pom for all versions which have been a newer version and replaces them with the latest version. versions:use-latest-releases searches the pom for all non-SNAPSHOT versions which have been a newer release and replaces them with the latest release version.
An artifact is a file, usually a JAR, that gets deployed to a Maven repository. A Maven build produces one or more artifacts, such as a compiled JAR and a "sources" JAR. Each artifact has a group ID (usually a reversed domain name, like com. example. foo), an artifact ID (just a name), and a version string.
As a Maven repository, Artifactory is both a source for artifacts needed for a build, and a target to deploy artifacts generated in the build process. Maven is configured using a settings. xml file located under your Maven home directory (typically, this will be /user.
To browse Maven repositories and to manipulate repository indexes open the Maven Repositories view by selecting Windows, Show View, Other... Once you select Other... Eclipse will display a dialog containing all available views. Select the Maven Repositories view under the Maven folder in the Show View dialog.
You can use the Maven Dependency Plugin goal get
together with LATEST
as version for your artifact:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DremoteRepositories=<URL_to_your_maven_repo> -Dartifact=<group_id>:<artifact_id>:LATEST -Dpackaging=jar -Ddest=<target_dir>/<artifact_name>.jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With