Setting up a Nexus Proxy
Nexus along with Gerrit and Jenkins is at the heart of our continous integration. As we are using some of the advanced features of Nexus the edition in use by The Linux Foundation for ONAP is the Professional edition. That does not, however, mean that you can't setup your own local Nexus proxy to help speed up your own builds or the builds for developers on your local network if you're wanting to do this inside your corporate network. If you're just setting up a proxy the OSS edition of Nexus will be all you really need. If you happen to have a license for the professional edition, the details listed here will still be applicable.
To setup a simple proxy to handle your ONAP builds first install and start Nexus. See the Sonatype documentation on how to actually install and setup Nexus.
Now that you've got your system up and running and have hopefully logged into it for the first time it's time to get the repositories configured. The rest of this documentation will be using the assumption that this is a dedicated proxy for ONAP. If you are adding repositories to an existing Nexus system to support building ONAP please talk with your local administrator about adding just what is needed from the following information.
The cleanest way to do all of this is to first open the repositories tab and and then remove all existing repositories. We'll be adding a couple back in but it's cleaner if everything matches.
Now that you've cleared out the repositories we'll start adding in all the repositories that are needed for cleanly building ONAP. All repositories added will be added as Proxy Repositories
Let's start with the Maven Central repostory.
Select 'Add...' -> 'Proxy Repository'
You will need to fill in the following information:
Repository ID: central
Repository Name: central
Remote Storage Location: https://secure.central.sonatype.com/maven2/
Select the 'Save' button as all the rest of the options will be left at their defaults.
Now that we've done one repository here is the information for all the repositories for which you can just take the defaults with the appropriate variables set.
Repository ID: SnapshotsThere is one more repository that you will want to mirror. This one needs a few extra variables set in the configuration.
Repository Name: Snapshots
Repository Policy: Snapshot
Remote Storage Location: https://nexus.onap.org/content/repositories/snapshots/ Not Found Cache TTL: 1 (NOTE: We have a few proxies on the same network as the master Nexus one so having a short negative TTL doesn't hurt much here. You can try adjusting this to higher values to help improve any negative caching misses)
Metadata Max Age: 5
Now that you've configured all of the repository proxies it's time to update the Public Repositories meta group.
Select the Public Repositories group from the repository list and if it is not currently on the Configuration tab switch to it.
You will want to press the |< button to move all of the Available Repositories into the Ordered Group Repositories box. After you have done that select Snapshot from the list and press the > button to move that back to the Available Repsositories section and press Save
The final step in utilizing this local proxy is modifying your personal (or build system's) .m2/settings.xml file to see it as a mirror. The following basic settings.xml file should be modified and placed in the proper place to make this work for your environment
<settings> <mirrors> <mirror> <id>onap-release-mirror</id> <name>Local Nexus mirror for onap builds</name> <url>http://[YOUR_SYSTEM_FQDN][:PORT_IF_NEEDED][/BASE_URI_FRAGMENT]/content/groups/public/</url> <mirrorOf>*,!onap-snapshot,!onap.snapshot</mirrorOf> </mirror> <mirror> <id>onap-snapshot-mirror</id> <name>Local Nexus mirror for onap snapshots</name> <url>http://[YOUR_SYSTEM_FQDN][:PORT_IF_NEEDED][/BASE_URI_FRAGMENT]/content/repositories/onap.snapshot</url> <mirrorOf>onap-snapshot,onap.snapshot</mirrorOf> </mirror> </mirrors> </settings>
A couple of example URLs are as follows:
http://nexus.example.com:8080/nexus/content/groups/public
http://nexus.example.com/content/groups/public
The difference is in the port and base URI fragment but that should help get you started.