Uses components. Lots of them.
→ more than 80% of a common enterprise software
Contains code, class files, object files, binary resources like images, property files, xml files…
In jar, war, ear, swf, so, bin, apk, apklib, zip, tar.gz, rpm, deb files and so on
Unbelievably lots of developers still do this today! |
This is where Sonatype Nexus can help! |
Proxy external repositories
Host external and internal artifacts
Lifecycle Integration
→ Nexus will be a key component of your enterprise development infrastructure
sudo cp nexus-professional-x.y.z-bundle.tar.gz /usr/local cd /usr/local sudo tar xvzf nexus-professional-x.y.z-bundle.tar.gz ln -s nexus-professional-x.y.z nexus cd nexus ./bin/nexus console
Nexus Professional has enterprise benefits, but open source edition is perfect for getting started. |
Apache Maven introduced repository concept:
All are retrieved from repositories on the internet, by the default the Central Repository
Read more about the scale needed to run OSSRH on the blog. |
Establish system/user wide setting for Maven to use Nexus:
<settings> <mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/nexus/content/groups/public</url> </mirror> </mirrors> <profiles> <profile> <id>nexus</id> <repositories> <repository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> </settings>
For other build tools this will be different. |
Structure storage for components using unique "GAV" coordinates:
<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.1.1</version> </dependency> <dependency> <groupId>com.google.inject</groupId> <artifactId>guice</artifactId> <version>3.0</version> <classifier>no_aop</classifier> </dependency> <dependency> <groupId>org.glassfish.admingui</groupId> <artifactId>war</artifactId> <version>10.0-b28</version> <type>war</type> </dependency>
Uses the GAV component coordinates. Coordinates map to specific locations in a Maven repository.
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> <version>3.4.1</version> </dependency>
Maps to:
org/apache/camel/ camel-core/ 3.4.1/ camel-core-3.4.1.pom camel-core-3.4.1.jar
File names are created using
artifactId-version-classifier.packaging
Classifiers javadoc and sources are appended to file name:
camel-core-3.4.1-javadoc.jar camel-core-3.4.1-sources.jar
Other repository formats use a different structure, but the Maven structure is understood and used by many tools. |
→ A Repository Manager helps with administration and usage
Public Group is exposed to users →
Examples:
Demo time! |
Release Repositories
Snapshot Repositories
Repositiory Groups merge them and expose the all under one URL. |
is when the benefits step up to the next level:
mvn clean deploy
<distributionManagement> <repository> <id>nexus-releases</id> <url>http://localhost:8081/nexus/content/repositories/releases</url> </repository> <snapshotRepository> <id>nexus-snapshots</id> <url>http://localhost:8081/nexus/content/repositories/snapshots</url> </snapshotRepository> </distributionManagement>
<servers> <server> <id>nexus</id> <username>admin</username> <password>admin123</password> </server> </servers>
Use the example project in labs/maven-deploy-example
mvn clean deploy mvn versions:set -DnewVersion=1.0.0 mvn clean deploy
Now components are available for everybody via the public group.
Your continuous integration server could do the deployment. |
Control availability of components
multi-step, controlled release process including reruns
via Nexus Maven Plugin
Enhanced LDAP, Atlassian Crowd
NuGet, Site, P2, OBR, YUM
Scale your organization, while maintaining performance for everybody!
Various scenarios and setups are common, including:
Component lifecycle management can be defined as the practice of
the components used in your software development lifecycle.
Sonatype CLM integration in