Skip to content

Nexus configuration tips

Use case: Open repositories and secured repositories in the same Nexus installation.

See also https://support.sonatype.com/entries/24901127-Sonatype-Nexus-Security-Cookbook.

  1. Set up anonymous user
    1. Remove access for the anonymous user to all repositories.
    2. Create privileges for releases and snapshots repositories.
    3. Create a new role with view and read access to releases and snapshots repositories.
    4. Assign this role to the anonymous user
  2. Set up repositories for a secret project
    1. Create two new repositories (proj-releases and proj-snapshots)
    2. Create privileges for both repositories.
    3. Create a new role (read-only) with view and read access to both repositories.
    4. Create a new role (deployment) full access to both repositores (todo add exactly which privileges are necessary for deployment)
    5. Copy distributionManagement section from the repository summary page in the Nexus web console and add to the project pom.xml.
      1. Url example: http://mvnrepo.company.no/index.html#view-repositories;releases~summary
    6. Add credentials to settings.xml or Jenkins credentials support which reference the repository id in pom.xml.
      1. It is possible to use the same id for both snapshots and releases repo in pom.xml to have only a single entry in settings.xml if the user is given deployment privileges to both repos.
Scheduled tasks run nightly
  • Remove snapshots from repository

  • Rebuild Maven metadata

  • Repair Repositories Index

Docs: http://books.sonatype.com/nexus-book/reference/scheduled-tasks.html