Nexus OSS3 as Private Maven Repository - chaitanyavangalapudi/devops-scripts GitHub Wiki
There are many private maven repository products available in the market like JFrog, Nexus. In our article we will discuss how to use Nexus OSS3 as maven artifactory.
Step #1 Configuring Nexus Private Maven Repository
Log in to your Nexus server at http://NexusURL:8081 (Default Username: admin, Default Password: admin123)
Go to Settings >> Repository >> Repositories >> Create Repository
- Choose maven2 (hosted) from the list
- Enter the desired name - my-private-repo
- Choose Version Policy as “Mixed”
- Layout policy as “Permissive”
- Deployment policy as “Allow Redeploy”
- Click on Create repository.
These properties allow us to create a custom hierarchical directory structure to store artifacts in our repository. The repository URL will be used while storing artifacts
Step #2 Configuring Deployment user (other than admin)
Step #2.1 Create Deployment Role
Go to Settings >> Administration >> Security >> Roles >> Create role
- Select "Nexus role"
- Enter Role ID as "nx-deploy"
- Role name as "Deployment Role"
- Role Description as desired
- From the privileges available, search for "nx-repository-view" , select the first role with three asterisks
- Add privilege :
nx-repository-view-*-*-*
- Click on Create role
This will add a new role "nx-deploy" which has permissions to push artifacts to our private maven repository.
Step #2.2 Create Deployment User
Go to Settings >> Administration >> Security >> Users >> Create local user
- ID Enter deployment
- Enter First Name, Last Name, Email as desired
- Enter Password of your choice.
- Select Status as Active
- From List of available Roles choose nx-deploy (which we just created above) and add to Granted Role using > button
- Click on "Create local user"
This will add a new user "deployment" which has all privileges required to deploy artifacts to our private maven repository.