$Revision: 1.9 $ |
$Name: $ |
$Date: 2006/04/13 13:54:09 $ |
Working with maven 2 |
$Source: /ppw/training/maven/repository/maven2/src/html/repositories.html,v $ |
Where Do All the Goodies Come From?
- Things maven needs are downloaded JIT
- Plugins
- Dependencies for projects
- …
- From remote repositories on the ‘net
- Cached in a local repository
Remote Repositories
- Many repositories
- Central repository
- Under control of the maven team
- Contains all known Java artifacts that they are allowed to distribute
- Could not be served by Apache because of Apache license politics
http://www./maven2/
- Mirrors
- ibiblio is constantly under strain (servers, bandwith)
- Mirrors are not really fast either
- Request not to rsync central
- Special
maven-proxy exists
- 3th party repositories
- Some providers choose to distribute their artifacts themselves
- Company-local repositories
- Own artifacts
- Private artifacts (access protection)
- Missing artifacts
- License issues (access protection)
- Obscure artifacts
- Solution to artifact naming problems
- Repositories can be accessed via any protocol supported by Wagon
- HTTP, HTTPS, FTP, SFTP, SCP, WebDAV, …
- In principle …
- HTTP and HTTPS validated by the author
- Our artifacts are also deployed to remote repositories for others to use
- Private company release repository
- Seperate snapshot repository: don‘t annoy other people with development versions
- Public company release repository
- Central repository
Typical setup
Project Server Layout
/
|
server in DMZ |
|-- ppw/
| |-- projects/
|
|
| | |-- dgt/
|
directory per client |
| | | |-- cvs_repository/
|
CVS repository root; access via ssh only |
| | | | |-- CVSROOT/...
|
|
| | | | |-- OSMOT/...
| | | | |-- OSMOT2/...
| | | | |-- expertPoll/...
| | | | `-- expertPollWebapp/...
|
module per project |
| | | |-- public_html/
|
project web home |
| | | | |-- .htaccess
|
access only for PeopleWare staff and client staff |
| | | | |-- index.html
| | | | |-- installation.html
| | | | |-- contact.html
| | | | .
| | | | .
| | | | .
|
information for the client |
| | | | |-- developer/
| | | | | |-- OSMOT/...
| | | | | |-- OSMOT2/..
| | | | | |-- expertPoll/...
| | | | | `-- expertPollWebapp/...
|
maven generated project sites |
| | | | `-- maven_repository/
| | | | `-- be/
| | | | `-- peopleware/
| | | | `-- dgt/
| | | | |-- OSMOT/
| | | | | |-- 1.0.0/...
| | | | | .
| | | | | .
| | | | | .
| | | | |
| | | | |-- OSMOT2/...
| | | | |-- expertPoll/...
| | | | `-- expertPollWebapp/...
|
maven release repository for this client |
| | | `-- share/
| | | |-- public/...
|
smb; non-version controlled, private material |
| | . .
| | . .
| | . .
. |
. |-- sysadmin/...
. `-- training/...
|
|
Configuring Which Repositories to Use
- Most often project-related
- All developers for a project need same setup
- Project dependent settings go in pom.xml
- Authentification depends on particular user
- Setting up Multiple Repositories
Configuring Mirrors
Configuring HTTP Proxies
Repository Layout
- Directory structure based on groupId
s/\./\//
- Like Java package structure
- Suggestion to use reverse domain name of issuing entity as part of groupId
- E.g., groupId=
be.peopleware.training.maven2
- be/peopleware/training/maven2/
- artifactId
- be/peopleware/training/maven2/helloWorld/
- version
- be/peopleware/training/maven2/helloWorld/1.2.3/
- Everything for this artifact/version in this directory
- Artifact
- be/peopleware/training/maven2/helloWorld/1.2.3/helloWorld-1.2.3.jar
- Consolidated POM
- be/peopleware/training/maven2/helloWorld/1.2.3/pom.xml
- Potentially other assemblies
- Checksums for each file
- Have a look at central
Abberations
Maven 1 legacy
- Directory structure based on groupId is new since maven 2
- To be backward compatible, old maven 1 structure is kept too
- E.g., Apache Jakarta Commons
- E.g., Hibernate
- Migration is in progress
Standard Sun Specification API‘s
- Package
javax.…
- Naming convention
- Some cannot be stored in public repository because of licensing issues
- Only POM in central
- Says where to download artifact
- E.g.,
javax.mail
- Company
missing-artifacts repository
- Download artifact from given location
- Install in company
missing-artifacts repository, with POM, checksum
Local Installation
Try-out You‘re Own Stuff Locally First
- Run mvn install
- Artifact is added correctly to local repository
Solve Repository Problems
- Install artifacts in his local repository directly
- Do it by hand, or
- maven-install-plugin:install-file
- You should provide a POM and checksum too (by hand for now)
- Bad practice in a group effort
- The problem you are having, other people will encounter too
- Better do it in a company repository from the start
|