41
Using Nexus Artifact Management in the Enterprise Kostis Kapelonis Athens Greece, February 2014

Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Using Nexus Artifact Management in the

Enterprise

Kostis Kapelonis

Athens Greece, February 2014

Page 2: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

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

Page 3: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 3

Why should you care?

Why do we need an artifact

manager?

Part 1

Page 4: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 4

A bit of history

Page 5: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 5

A bit of history

The problem of using

Ant (especially with CVS)

Page 6: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 6

Binaries should not be stored in VC

Version Control

Java files

Jars

Ant

Compile

Checkout

Page 7: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Modern times

21/02/2014 7

Page 8: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 8

Binaries should not be stored in VC

Version Control

Java files

Jars

Maven

Compile

Checkout

“Binary Repo”

Download

Page 9: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Maven Central

21/02/2014 9

Page 10: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Maven complaints

21/02/2014 10

Page 11: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

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

Page 12: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

The wrong way

21/02/2014 12

Page 13: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

The correct way

21/02/2014 13

Page 14: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

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

Page 15: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 15

Different kinds of Jars/libraries

Central Other Repos

Non- Maven

Our jars

Page 16: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

The players

Sonatype Nexus

Apache Archiva

JFrog Artifactory

21/02/2014 16

Page 17: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 17

Using Nexus

Part 2

Page 18: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 18

Step 1

In your .m2/settings.xml

Page 19: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

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/

Page 20: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Search a jar

21/02/2014 20

Page 21: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Search a jar (other)

21/02/2014 21

Page 22: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Nexus repos

21/02/2014 22

Page 23: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 23

Nexus Repo types

Proxy

• 85%

• caching

Hosted

• 10%

• publishing

Virtual

• 1%

• Maven 1

Group

• 4%

• exposing

Page 24: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 24

Proxy repos

Proxy repos cache existing

repos (central, JBoss, Spring

etc)

You add new Proxy Repos as

Admin in Nexus

Page 25: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

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

Page 26: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 26

Hosted repos

Virtual repos are used for

Maven 1 compatibility

We don’t need this, ignore it.

Page 27: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

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

Page 28: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

The big picture

21/02/2014 28

Page 29: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 29

Using Nexus for multiple

projects/clients

Part 3

Page 30: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Default Nexus Repositories out of the box

21/02/2014 30

Central Snapshots Releases

3rd Party Maven 1 Public

Page 31: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Some real life observations

21/02/2014 31

Page 32: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Do we release Quarz?

21/02/2014 32

Page 33: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Is Eudra an external library?

21/02/2014 33

Page 34: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Do we create apache POI?

21/02/2014 34

Page 35: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Suggested roadmap

21/02/2014 35

Page 36: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Suggested structure

21/02/2014 36

Admin

Publish

Read only

Page 37: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Suggested structure

• Releases/snapshots

• 3rd party Common

• Releases/snapshots

• Exposing group Project A

• Releases/Snapshots

• Exposing group Project B

21/02/2014 37

Page 38: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Suggested structure

21/02/2014 38

Nexus

Client B

Client C

We

Client A

Page 39: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

What we give to the client

Project Source code

Project Nexus URL

Project Release

21/02/2014 39

Page 40: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

Thank you

21/02/2014 40

Page 41: Using Nexus Artifact Management in the Enterprise · Maven 1 compatibility We don’t need this, ignore it. 21/02/2014 27 Hosted repos Group repos are used for ... Using Nexus for

21/02/2014 41

More?

Backup Slides