打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
[Maven 2] Repositories
$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
    • ~/.m2/repository/

Remote Repositories

  • Many repositories
    • Central repository
    • 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

In practice, at PeopleWare

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/...
 
  • un*x group per client

Configuring Which Repositories to Use

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
      • Like Java package names
    • 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
      • E.g., source zip
    • Checksums for each file
      • MD5
  • Have a look at central

Abberations

Maven 1 legacy

Standard Sun Specification API‘s

  • Package javax.…
  • Naming convention
    • Legacy issues
  • Some cannot be stored in public repository because of licensing issues
    • Only POM in central
    • Says where to download artifact
    • E.g., javax.mail
      • […]            <distributionManagement>            <downloadUrl>http://java.sun.com/products/javamail/downloads/index.html</downloadUrl>            </distributionManagement>            […]            
  • 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
    • With POM
    • With checksum

Solve Repository Problems

  • Install artifacts in his local repository directly
  • Do it by hand, or
  • maven-install-plugin:install-file
    • mvn install:install-file -DgroupId=group-id         -DartifactId=artifact-id         -Dversion=version         -Dpackaging=packaging         -Dfile=fileToInstall        
    • Copies the fileToInstall into the local repository, in the directory structure based on group-id, with file name artifcact-id-version.packaging
  • 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

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Maven学习笔记2——向repository上传artifact
Maven系列2--pom.xml 配置详解
Maven入门--概念与实例
Failed to read artifact descriptor for xxx:jar 和Missing artifact有关问题
Maven编译代码的相关命令
Intellij Ant打包reportng报程序包不存在错误
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服