https://github.com/griddynamics/nexus-replication-plugin
This is Sonatype Nexus plugin that facilitates push-replication to remote proxy repositories when new (Maven) artifacts are stored in a hosted repository. Let's say you have 2 or more instances of Nexus. When artifact is uploaded to one of them, that Nexus will send notifications to its peers. Then the Receving Nexuses poll the artifact from the original instance.
Plugin should be installed into all Master and Peer Nexus servers. You may have multiple Nexus instances configured as Masters. They will poll artifacts from each other.
- Download source from https://github.com/griddynamics/nexus-replication-plugin.
- Run
mvn package
in root directory (project requires Apache Maven 3.0.4 -- 3.0.5 and JDK 1.7+). - Unzip the
target/nexus-replication-plugin-1.0-SNAPSHOT-bundle.zip
file into the plugin-repository directory (located in$NEXUS_HOME/sonatype-work/nexus/plugin-repository
). - Download a sample of the configuration file from https://github.com/griddynamics/nexus-replication-plugin/blob/master/replication-plugin.xml.
- Copy the
replication-plugin.xml
file into the conf directory (located in$NEXUS_HOME/sonatype-work/nexus/conf
). - Edit the config file to suit your needs (read instructions inside the file).
- Restart Nexus.
You also should configure each Nexus peer instance otherwise they won't poll the uploaded artifact.
- Reproduce points 1 - 3 from the previous list.
- Create proxy repository for the each hosted repository (repositories that should be replicated and located in the master Nexus).
- Restart Nexus.
Plugin REST API is available at service/local/artifact/maven/update
. This resource receives POST request with a body like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<artifact-meta-info>
<groupId>com.griddynamics.cd</groupId>
<artifactId>nexus-replication-plugin</artifactId>
<version>1.0-20150519.140619-2</version>
<repositoryId>snapshots</repositoryId>
<extension>jar</extension>
<nexusUrl>http://localhost:8081/nexus</nexusUrl>
</artifact-meta-info>
This method returns XML formatted response. If artifact was resolved successfully response will be:
<rest-status>
<isSuccess>true</isSuccess>
<message>Artifact is resolved.</message>
</rest-status>
otherwise isSuccess
will be false and message
will contain error description.