6.6. Configuring deployment to a remote Nexus repository
Nexus is a repository manager frequently used in organizations to centralize storage and management of software development artifacts. It is possible to configure your project so that artifacts produced by every build are automatically deployed to a repository on a remote Nexus server.
To configure your project to deploy artifacts to a remote Nexus repository, add a
distributionManagement
element to your project's pom.xml
file as demonstrated in the code example below.
<distributionManagement> <repository> <id>deployment</id> <name>Internal Releases</name> <url>http://your_nexus_host:8081/nexus/content/repositories/releases</url> </repository> <snapshotRepository> <id>deployment</id> <name>Internal Releases</name> <url>http://your_nexus_host:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
Replace the URLs in the example with real URLs of your Nexus repositories. The repository specified in the
snapshotRepository
element is used when the -SNAPSHOT
qualifier is appended to the project's current version number. In other cases the repository specified in the repository
element is used.
If your Nexus server requires authentication, you will also need to modify your projects Maven settings to add your credentials in the
settings-security.xml
file, using a master password. By default, this file is in ~/.m2
folder, unless you have changed its location by modifying the kie.maven.settings.custom system property.
<servers> <server> <id>deployment</id> <username>admin</username> <password>admin.123</password> </server> </servers>
With this configuration in place, clicking the Build and Deploy button in Business Central executes a Maven build and deploys the built artifacts both to the local repository and to one of the Nexus repositories specified in the
pom.xml
file.