Question
How can I setup and fill my Apache Archiva repository with CQ5 artifacts in order to use it as a maven repository source for development, instead of using Day maven repository (repo.adobe.com is not officially supported) ?
Answer, Resolution
Apache Archiva is a repository management software that allows you to deploy your maven
bundles to the repository. It also allows you to cache bundles from external repositories so your
developers will stay on your network rather than going to external sources for artifacts. The goal of this article is to describe a process that deploys CQ available artifacts into Archiva.
Install Archiva :
- Download the latest version of Archiva from their website (http://archiva.apache.org/download.html)
- Follow the instructions for installation on your appropriate OS. (http://archiva.apache.org/docs/1.3.6/adminguide/)
Configure Archiva :
- Open your browser to the Archiva installation (http://<IP of your Archiva server>:8080/archiva)
- The first time you startup Archiva it will ask you to create a username/password for the
admin account. Go ahead and do that. - Create a deployment user, for example "deployer". This user will need the Role 'Repository Manager'.
- Note : Take care to operate a first login with this new user, a password change will be asked at this moment. Unless you do that first, the Maven deploy commands issued with this user will fail.
Setup the Maven settings.xml file :
- In your .m2/settings.xml add the following lines to define your Archiva Repository and the login/password Maven will use to deploy the Artifacts
<profile>
<id>day-central</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>internal</id>
<name>My Company Archiva Repository</name>
<url>http://<IP of your Archiva server>:8080/archiva/repository/internal</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>internal</id>
<name>My Company Archiva Repository</name>
<url>http://<IP of your Archiva server>:8080/archiva/repository/internal</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<servers>
<server>
<id>internal</id>
<username>deployer</username>
<password>deployer_pwd</password>
</server>
</servers>
Get CQ available libraries from a running instance :
- Use the script present on the following documentation page : http://dev.day.com/docs/en/cq/current/developing/developmenttools/developing_with_eclipse.html#Central%20dependency%20management%20with%20Apache%20Archiva.
Generate the Maven deploy commands that matches the CQ available artifacts :
To do this, run the attached Jar file with the following parameters :
- Remote repo URL
- Remote repo Id
- Directory where you just dowloaded the CQ libraries
Example : java -jar generateMavenDeployCommands.jar http://localhost:8080/archiva/repository/internal internal C:\cq53Jars
Pobierz
3 files are generated in the directory of the Jar :
- deployMavenArtifact.sh
Shellscript for MacOs + Linux that contains the mvn:deploy commands.
- deployMavenArtifact.bat
Windows Bat script that contains the same deploy instructions, preceded by the call commands.
- dependenciesSnippet.xml
Contains the list of all found artifacts in the form of a dependency list that you can partially integrate to your project pom file.
Applies to
CQ 5.3+