Hi @akatsuki07!
For your use case, there is no need to establish a connection between Nexus and AEM.
What you need to do is:
- Tell Maven to deploy your bundle to your Nexus repository
- Tell Maven to use your Nexus repository for dependency resolution
For 1, there is a good tutorial from Sonatype. The most important part should be to add the following to your Maven settings.xml file (either at /conf in your Maven installation or at your ~/.m2 directory):
<servers>
<server>
<id>nexus-snapshots</id>
<username>deployment</username>
<password>the_pass_for_the_deployment_user</password>
</server>
</servers>Along with an according entry in your projects pom.xml file:
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>But more details and explanations are outlined in the linked tutorial.
For 2, you will need to add your Nexus server as an additional repository for dependency resolution, e.g. to your settings.xml (see above). This is outlined in this Maven guide on how to use multiple repositories:
<repository>
<id>nexus-repo</id>
<name>Internal Nexus repository</name>
<url>http://yournexus:8001/</url>
</repository>
There are several ways to include this for different purposes, e. g. by adding it to a specific profile that can be activated by default or only when specified. Please check the Maven documentation for more details.
Once you have deployed your bundle to Nexus and any consuming project is built (with dependency resolution pointing at your Nexus server), the bundle dependency will automatically be handled as with any external dependency.
Apart from these two steps you may also want to add your Nexus server as a mirror for external repositories. Please refer to this Maven guide for further details.
Hope that helps!