Install the cq5-archiva-servlet-1.6.zip. (It may fail to load on CQ 5.2.1, but ignore the message then install.)
Use a local CQ5 instance as a maven repository source for development, instead of using Day maven repository.
This method isn't officially supported.
Solution
-
-
Configure your project pom.xml to use your local CQ5 instance as a maven repository
<repositories>
<repository>
<id>localinstance</id>
<name>CQ 5.x localinstance</name>
<url>http://localhost:4502/maven/repository</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>localinstance</id>
<name>CQ 5.x localinstance</name>
<url>http://localhost:4502/maven/repository</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories> -
Additionally, you can use as parent dependency the following:
<parent>
<groupId>com.day</groupId>
<artifactId>cq5-parent</artifactId>
<version>5.6.0</version> (if for example your instance is a 5.6.0)
</parent>The groupId/artifactId is configurable with Sling configuration, and the version is not important. (But make sense to use according to target, such as 5.2.1/5.3/5.4).
-
In your .m2/settings.xml, add the following lines to define the login/password:
<server>
<id>localinstance</id>
<username>admin</username>
<password>admin</password>
</server> -
Additionally, you can add your jar/pom in the "/var/maven/repository" (using same structure as maven store it usually)
Notes:
- You can't really browse through the maven repository with your browser with that servlet, it returns a valid response at the moment.
- Additional libraries like maven-sling-plugin and maven-packutil-plugin are also already present so accessing day repo is not required for them anymore.
- The "/var/maven/tpl/archiva-parent.pom" includes apache people repository and ibliblio mirror automatically so that other dependencies can be found there, you can customize it if necessary.
- You can also get a generated pom file that includes all the existing dependencies so you can easily copy/paste those you need for your maven module if you don't want to use the above parent dependency. For example using the URL: http://localhost:4502/maven/dependencies.
- You can use a maven archive as proxy so that if your cq5 instance is not running, it can still serve the files.
- You can't really browse through the maven repository with your browser with that servlet, it returns a valid response at the moment.
Quick help for the maven-packutil-plugin (which is not currently an official plug-in, but useful)
<plugin>
<groupId>com.day.cq.tools</groupId>
<artifactId>maven-packutil-plugin</artifactId>
<version>0.0.1</version>
<configuration>
<targetURL>http://localhost:4502</targetURL>
<user>admin</user>
<password>admin</password>
<workspace>crx.default</workspace>
</configuration>
<executions>
<execution>
<id>install-package</id>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
Загрузить
Загрузить