| Nexus Repository Installation and Setup |

WHAT/WHY

Nexus Repository OSS is (server) software for an Artifact Repository Manager, which is used to store and retrieve binaries (components/libraries).

The most common/basic way teams share output binaries is by manually copying them over to a “lib” directory, or referencing a project as a dependency. This basic approach, while simple, has project sustainability problems.

The more methodical and enterprise-centric approach is to have teams pull/push from a shared repository. Small development teams to large, within the same team or across multiple teams, this provides benefits to all.

PERSPECTIVE

This article is from a Java development perspective – using Apache Ivy as the tool for retrieving project dependencies. The installation is for Windows Server.

PREREQUISITES

INSTALLATION AND SETUP


Extracting and Installing

1) “\users\%username%\downloads” (or whatever your default download location is)
2) browse…
3) make new folder
4) “sonatype” (or whatever directory name you want)
5) ok
6) “c:\program files\sonatype” (full path from #4)
7) extract

1) “c:\program files\sonatype\nexus-3.2.1-01\bin”
2) run an elevated command prompt (as an administrator)
3) change to “c:\program files\sonatype\nexus-3.2.1-01\bin” as the working directory
4) “nexus.exe \install”
5) installed service ‘nexus’

Starting the service (app)

1) search services.msc
2) run services.msc
3) find “nexus”
4) right click and start
5) service starting progress bar
If installation errors occurred then the web interface will not launch and/or the windows service will not start. The following is a debugging step for if that happens. The logs are stored in the “log” directory (as demonstrated below), which should uncover what went wrong.

1) “c:\program files\sonatype\sonatype-work\nexus3”
2) log
The most common reason for failure is that port 8081 (the default for Nexus) is already in use. Luckily, changing the port is as simple as changing a config property. Refer to Sonatype’s documentation (here) for the change.

Using the app

localhost:8081

landing page

1) sign in
2) “admin”
3) “admin123” (default password)
4) sign in

1) configure (gear symbol)
2) repositories
3) “maven-central” → proxy to “repo1.maven.org/maven2”
4) “maven-public” → group containing proxy “maven-central” and hosted “maven-releases”
5) “maven-releases” → hosted release versions
6) “maven-snapshots” → hosted dev versions

1) name: maven-releases
2) type: hosted
3) endpoint (url): “localhost:8081/repository/maven-releases”

Configuring Ivy

A sample “ivysettings.xml” that points to “maven-public”, which is the group containing the proxy to “maven-central” and the hosted “maven-releases”.

CONCLUSION

Our repository manager is now ready! Binaries can be pushed and pulled to/from it, as well, we can configure our Jenkins builds to make use of it.

In a future article we will be utilizing our new repository manager – having maven deploy artifacts to it.