I'm building against various Lucene and Solr Maven artifacts from Apache's Maven repository hosted in the Nexus repository manager. The artifacts are version 4.0-SNAPSHOT
and get updated daily, with older artifacts being deleted regularly.
I was wondering how to peg the artifacts to a specific date, so whenever a Maven client would ask for solr-core 4.0-SNAPSHOT
, it would get the same version even if there was a newer one upstream.
I would also like to know how to explicitly update to the latest 4.0-SNAPSHOT
, but still keep all previous versions that were downloaded.
Specifically, the "Apache Snapshots" repository is the default one that comes setup when you install Nexus.
Snapshot artifacts are artifacts generated during the development of a software project. A Snapshot artifact has both a version number such as “1.3. 0” or “1.3” and a timestamp in its name.
Available in Nexus Repository Pro only To view an component's dependencies, browse the repository storage or the repository index, select a component (or a component's POM), and then click on the Maven Dependency tab.
When a snapshot is deployed to a repository server each new deployment is actually deployed as a time stamped version with an iterator number appended. If you want to use a specific version you just use the timestamp version of the snapshot rather than -SNAPSHOT.
E.g. look at https://repository.apache.org/content/groups/snapshots/org/apache/maven/artifact/maven-artifact/3.0-alpha-2-SNAPSHOT/
You could use this artifact as
<groupId>org.apache.maven.artifact</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.0-alpha-2-SNAPSHOT</version>
which would change it each time a new snapshot is deployed or you could use
<groupId>org.apache.maven.artifact</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.0-alpha-2-20090214.020928-1</version>
which would stay the same. Keep however in mind that a snapshot repository is NOT static by nature and these artifacts could potentially disappear completely. Only do that if you are using an internal repository server that you can control and therefore ensure that those snapshots don't disappear on you.
Another way to do it is to actually cut a release and use that..
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