For a sample custom consumer, you can checkout the archiva-consumer-plugin at the archiva sandbox in the SVN repository: Prior to release 1.4, plexus components are not anymore supported, you must use Spring components.
Below are the steps on how to create a custom repository consumer and plug it in Archiva:
- Create a project for your component.
- Declare your class or in this case, consumer as a component as shown in the example below. This should be put at the class level.
Ex. @Service("knownRepositoryContentConsumer#discover-new-artifact") @Scope("prototype") where, Service: unique id for your consumer. Scope: the creation strategy prototype or singleton.
- Package your project by executing 'mvn clean package'
- Let's say you are using the apache-archiva-1.4-M2-bin.tar.gz to run Archiva. Unpack the binaries then go to bin/linux-x86-32/ (assuming you are running on Linux), then execute './run.sh console'. Then stop or shutdown Archiva after it started. (This is necessary to unpack the war file.)
- Copy the jar file you created in step 4 in apache-archiva-1.4-M2/apps/archiva/webapp/lib/
- Add the necessary configurations in archiva.xml (in this case, add 'discover-new-artifact' as a knownContentConsumer)
- Start up Archiva again.
Prior to version 1.4-M2, you can use an archetype.
mvn archetype:generate \ -DarchetypeRepository=repo1.maven.org \ -DarchetypeGroupId=org.apache.archiva \ -DarchetypeArtifactId=archiva-consumer-archetype \ -DarchetypeVersion=1.4-M2
Note: if you want to use a SNAPSHOT version, replace with the following parameter: -DarchetypeRepository=http://vmbuild.apache.org/archiva/repository/snapshots \