Nexus (Maven)
Configure Sonatype Nexus Repository for NES Maven artifacts
Teams using Sonatype Nexus can manage access to NES artifacts through 3 easy steps:
- Create a Proxy Repository (
NES Remote Repository
) for our private Maven registry. - Configure the Proxy Repository with a Routing Rule
- Configure a Group Repository to access both NES and OSS packages.
Step 1: Create a Routing Rule
- Navigate to
Server Administration and Config
>Routing Rules
- Select
Create Routing Rule
- Provide the following configuration values on the Create Routing Rule page.
For configuration values not defined below, use the default value that Nexus provides.
Name nes-maven-routing Description Route NES requests to HeroDevs registry Mode Allow Matchers ^/com/herodevs/nes/.*
,^/net/jawr/extensions/.*
,^/struts/.*
,^/commons-beanutils/.*
,^/org/apache/.*
,^/org/springframework/.*
,^/net/sf/dozer/.*
,^/org/mybatis/.*
,^/org/springdoc/.*
, - Create the Routing Rule
Step 2: Create a NES Proxy Repository & Group Repository for your team
First, create a NES Proxy Repository which will handle only the NES artifacts requested.
- Navigate to
Server Administration and Config
>Repositories
- Select
Create Repository
, then selectMaven (proxy)
as the recipe. - Provide the following configuration values on the Create Repository page.
For configuration values not defined below, use the default value that Nexus provides.
Name nes-maven Remote Storage https://registry.nes.herodevs.com/maven Blob Store provide the appropriate store for your environment Routing Rule nes-maven-routing (from Step 1) Authentication checked Authentication Type Username Username nexus Password <NES_ACCESS_TOKEN> - Create the repository.
Next, create a Group Repository for your team so that they can access both NES and public artifacts from a single remote repository.
- Navigate to
Server Administration and Config
>Repositories
- Select
Create Repository
, but this time selectMaven (group)
as the recipe. - Provide the following configuration values on the Create Repository page.
For configuration values not defined below, use the default value that Nexus provides.
Name maven-default Blob Store provide the appropriate store for your environment Members maven-central
,nes-maven
, etc. - Create the repository.
Configuring your Maven/Gradle client
Review the Nexus Maven or Gradle documentation to setup your project or client accordingly.
Examples
Maven (settings.xml)
Gradle (build.gradle)
<settings>
<servers>
<!-- other servers -->
<server>
<id>nexus</id>
<username>${env.NEXUS_USER}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
</servers>
<profiles>
<!-- other profiles -->
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>maven-default</name>
<url>https://company-nexus.com/repository/maven-default/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>maven-default</name>
<url>https://company-nexus.com/repository/maven-default/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!-- other active profiles -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>