Configure Sonatype Nexus Repository Manager to ensure that the patched dependencies from Endor Labs are fetched and used correctly. The following procedures use Maven as the repository type, you can select the repository type based on your requirements.
Create a remote repository for Endor Patching
Create a remote repository to fetch artifacts from the Endor Patch repository.
- Log in to the Nexus Repository Manager.
- Go to Repositories and click Create repository.
- Select maven2 (proxy) as the recipe.
- Enter the repository name, such as
endor-patch
. - In Remote Storage, enter the Endor Patch repository URL (typically given by Endor Labs) like
https://factory.endorlabs.com/v1/namespaces/<namespace>/maven2
. Replace<namespace>
with your Endor Labs tenant name. - Select Authentication, and enter your Endor Labs API Key ID as the User Name and your Endor Labs API Key secret as the password.
- Click Create repository to save.
Prioritize Endor patch repository in Maven group
If you have a Maven group repository that combines multiple repositories, you need to prioritize the Endor patch repository.
- Log in to the Nexus Repository Manager.
- Select Browse and navigate to your Maven group repository that combines multiple repositories.
- Edit the group repository and move the
endor-patch
repository to the top of the order in the members list. This ensures that Endor Patch is checked first before any other repository for patch dependencies. - Click Save to save the changes.
Set up routing rules in other repositories
You can set up routing rules in repositories, other than the Endor patch repositories, to exclude Endor patch repositories. This will prevent other repositories from overriding the Endor patch dependencies.
- Log in to the Nexus Repository Manager.
- Select Repository in the Administration menu.
- Select Create Routing Rule.
- Enter a name such as
exclude-endor-patch
. - Select Block as the mode.
- Enter the regular expression to block Endor patches in Matchers. For example,
com/endor/patch/.*
. - Click Create Routing Rule to save the rule.
- Select Browse and navigate to the proxy repository that you want to edit.
- Click Edit and select the routing rule that you created as the Routing Rule.
- Click Save.