using nexus artifact management in the enterprise · maven 1 compatibility we don’t need this,...
TRANSCRIPT
Using Nexus Artifact Management in the
Enterprise
Kostis Kapelonis
Athens Greece, February 2014
Agenda
1. What is Nexus and why we
need it
2. Nexus features
3. Using Nexus in an enterprise
company for multiple projects
21/02/2014 2
21/02/2014 3
Why should you care?
Why do we need an artifact
manager?
Part 1
21/02/2014 4
A bit of history
21/02/2014 5
A bit of history
The problem of using
Ant (especially with CVS)
21/02/2014 6
Binaries should not be stored in VC
Version Control
Java files
Jars
Ant
Compile
Checkout
Modern times
21/02/2014 7
21/02/2014 8
Binaries should not be stored in VC
Version Control
Java files
Jars
Maven
Compile
Checkout
“Binary Repo”
Download
Maven Central
21/02/2014 9
Maven complaints
21/02/2014 10
Common Maven complaints
“Maven downloads the whole internet”
“The central repository is down”
“The central repository does not have the
latest version”
“Closed-source library X is not in the central
repository”
“I cannot publish my library in the central
repository”
“I still need to mail my colleague with my jar”
21/02/2014 11
The wrong way
21/02/2014 12
The correct way
21/02/2014 13
The need for a binary artifact manager
Is central really “central”?
Some frameworks have their own repos
Some libraries are not even “mavenised”
Big companies need to publish artifacts
as well
Maven also has snapshots
Other problems such as licences
21/02/2014 14
21/02/2014 15
Different kinds of Jars/libraries
Central Other Repos
Non- Maven
Our jars
The players
Sonatype Nexus
Apache Archiva
JFrog Artifactory
21/02/2014 16
21/02/2014 17
Using Nexus
Part 2
21/02/2014 18
Step 1
In your .m2/settings.xml
21/02/2014 19
Step 2
Remove all repo URLs
from your POM files.
Your project should
know nothing about
Maven repos
http://blog.sonatype.com/2009/02/why-putting-repositories-in-your-poms-is-
a-bad-idea/
Search a jar
21/02/2014 20
Search a jar (other)
21/02/2014 21
Nexus repos
21/02/2014 22
21/02/2014 23
Nexus Repo types
Proxy
• 85%
• caching
Hosted
• 10%
• publishing
Virtual
• 1%
• Maven 1
Group
• 4%
• exposing
21/02/2014 24
Proxy repos
Proxy repos cache existing
repos (central, JBoss, Spring
etc)
You add new Proxy Repos as
Admin in Nexus
21/02/2014 25
Hosted repos
Hosted repos used for
uploading our artifacts on
Nexus
You can upload manually (via
Web) or via the mvn
command line
21/02/2014 26
Hosted repos
Virtual repos are used for
Maven 1 compatibility
We don’t need this, ignore it.
21/02/2014 27
Hosted repos
Group repos are used for
exposing to the outside world
the contents of Nexus
Once you add a proxy repo
you also need to “expose” it
The big picture
21/02/2014 28
21/02/2014 29
Using Nexus for multiple
projects/clients
Part 3
Default Nexus Repositories out of the box
21/02/2014 30
Central Snapshots Releases
3rd Party Maven 1 Public
Some real life observations
21/02/2014 31
Do we release Quarz?
21/02/2014 32
Is Eudra an external library?
21/02/2014 33
Do we create apache POI?
21/02/2014 34
Suggested roadmap
21/02/2014 35
Suggested structure
21/02/2014 36
Admin
Publish
Read only
Suggested structure
• Releases/snapshots
• 3rd party Common
• Releases/snapshots
• Exposing group Project A
• Releases/Snapshots
• Exposing group Project B
21/02/2014 37
Suggested structure
21/02/2014 38
Nexus
Client B
Client C
We
Client A
What we give to the client
Project Source code
Project Nexus URL
Project Release
21/02/2014 39
Thank you
21/02/2014 40
21/02/2014 41
More?
Backup Slides