MavenのPWを使用するためのアイデア

nexus3中央倉庫を交換アリクラウド/

参考:ここでは、リンクの内容を書き込み 
、中央倉庫を見つけるために、

ここで説明する絵を書きます

その後に変更: 
ここで説明する絵を書きます

http://maven.aliyun.com/nexus/content/groups/public/
  • 1

PWの考え方と対応する構成Mavenを使用します

参考: 
ここでは、コンテンツへのリンクを書きます

彼らの新しいバー - まず、Mavenプロジェクトを作成します。

その後、 
ここで説明する絵を書きます

ここで説明する絵を書きます

機械Mavenの設定ファイルを参照してください、 
ここで説明する絵を書きます

そして、それを開いた: 
ここで説明する絵を書きます 
私たちのMavenのPWとライブラリを公開するために使用さservers-を追加します。

形式は次のとおりです。

  1.  
    <?XMLバージョン= "1.0"エンコード= "UTF-8" ?>
  2.  
    < 設定 のxmlns = "http://maven.apache.org/SETTINGS/1.0.0"
  3.  
    xmlns:XSI = "http://www.w3.org/2001/XMLSchema-instance"
  4.  
    XSI:のschemaLocation = "http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" >
  5.  
    < ミラー >
  6.  
    <! - 内部のmaven - >
  7.  
    <mirror>
  8.  
    <id>central </id>
  9.  
    <mirrorOf>* </mirrorOf>
  10.  
    <name>Central Repository </name>
  11.  
    <url>http://你仓库的地址/repository/maven-public/ </url>
  12.  
    </mirror>
  13.  
    <!-- 阿里云仓库 -->
  14.  
    <mirror>
  15.  
    <id>alimaven </id>
  16.  
    <mirrorOf>central </mirrorOf>
  17.  
    <name>aliyun maven </name>
  18.  
    <url>http://maven.aliyun.com/nexus/content/repositories/central/ </url>
  19.  
    </mirror>
  20.  
     
  21.  
    <!-- 中央仓库1 -->
  22.  
    <mirror>
  23.  
    <id>repo1 </id>
  24.  
    <mirrorOf>central </mirrorOf>
  25.  
    <name>Human Readable Name for this Mirror. </name>
  26.  
    <url>http://repo1.maven.org/maven2/ </url>
  27.  
    </mirror>
  28.  
     
  29.  
    <!-- 中央仓库2 -->
  30.  
    <mirror>
  31.  
    <id>repo2 </id>
  32.  
    <mirrorOf>central </mirrorOf>
  33.  
    <name>Human Readable Name for this Mirror. </name>
  34.  
    <url>http://repo2.maven.org/maven2/ </url>
  35.  
    </mirror>
  36.  
    </mirrors>
  37.  
    <servers>
  38.  
    <server>
  39.  
    <id>nexus-releases </id>
  40.  
    <username>admin </username>
  41.  
    <password>你的密码 </password>
  42.  
    </server>
  43.  
    <server>
  44.  
    <id>nexus-snapshots </id>
  45.  
    <username>admin </username>
  46.  
    <password>你的密码 </password>
  47.  
    </server>
  48.  
    </servers>
  49.  
    </settings>

发布快照及正式版本

maven(15),快照与发布,RELEASE与SNAPSHOT

在pom.xml文件最后添加distributionManagement发布管理节点:

ここで説明する絵を書きます

例如:

  1.  
    <distributionManagement>
  2.  
    <repository>
  3.  
    <id>nexus-releases </id>
  4.  
    <name>Nexus Release Repository </name>
  5.  
    <url>http://你的maven地址/repository/maven-releases/ </url>
  6.  
    </repository>
  7.  
    <snapshotRepository>
  8.  
    <id>nexus-snapshots </id>
  9.  
    <name>Nexus Snapshot Repository </name>
  10.  
    <url>http://你的maven地址/repository/maven-snapshots/ </url>
  11.  
    </snapshotRepository>
  12.  
    </distributionManagement>
  • 注意一下
  1.  
    <groupId>net.funfunle </groupId>
  2.  
    <artifactId>baselib </artifactId>
  3.  
    <!--<version>1.0-SNAPSHOT</version>-->
  4.  
    <version>1.0.1-RELEASE </version>

groupid这些,

  1.  
    <groupId>net.funfunle </groupId>
  2.  
    <artifactId>baselib </artifactId>
  3.  
    <!--<version>1.0-SNAPSHOT</version>-->
  4.  
    <version>1.0.1-RELEASE </version>

决定发布的是正式版本release还是快照snapshot的是

  1.  
    <!--<version>1.0-SNAPSHOT</version>-->
  2.  
    <version>1.0.1-RELEASE </version>

版本号及发布类型,有一点也需要注意,snapshot快照允许重复发布更新同一个版本,而release是不允许的,release每次发布版本号都要加的。

发布方式: 
ここで説明する絵を書きます

在mavenproject点击发布deploy。

新项目中引用发布的类库

maven2获取最新版本方式。

这里写链接内容 
maven pom文件详解

ここで説明する絵を書きます

ここで説明する絵を書きます

ここで説明する絵を書きます

maven3获取最新版本方式 
这里写链接内容

  1.  
    Now I know this topic is old, but reading the question and the OP supplied answer it seems the Maven Versions Plugin might have actually been a better answer to his question:
  2.  
     
  3.  
    In particular the following goals could be of use:
  4.  
     
  5.  
    versions: use-latest- versions searches the pom for all versions which have been a newer version and replaces them with the latest version.
  6.  
    versions: use-latest-releases searches the pom for all non- SNAPSHOT versions which have been a newer release and replaces them with the latest release version.
  7.  
    versions: update-properties updates properties defined in a project so that they correspond to the latest available version of specific dependencies. This can be useful if a suite of dependencies must all be locked to one version.
  8.  
    The following other goals are also provided:
  9.  
     
  10.  
    versions:display-dependency-updates scans a project 's dependencies and produces a report of those dependencies which have newer versions available.
  11.  
    versions:display-plugin-updates scans a project's plugins and produces a report of those plugins which have newer versions available.
  12.  
    versions: update- parent updates the parent section of a project so that it references the newest available version. For example, if you use a corporate root POM, this goal can be helpful if you need to ensure you are using the latest version of the corporate root POM.
  13.  
    versions: update- child-modules updates the parent section of the child modules of a project so the version matches the version of the current project. For example, if you have an aggregator pom that is also the parent for the projects that it aggregates and the children and parent versions get out of sync, this mojo can help fix the versions of the child modules. (Note you may need to invoke Maven with the -N option in order to run this goal if your project is broken so badly that it cannot build because of the version mis- match).
  14.  
    versions: lock-snapshots searches the pom for all - SNAPSHOT versions and replaces them with the current timestamp version of that - SNAPSHOT, e.g. -20090327.172306 -4
  15.  
    versions: unlock-snapshots searches the pom for all timestamp locked snapshot versions and replaces them with -SNAPSHOT.
  16.  
    versions:resolve-ranges finds dependencies using version ranges and resolves the range to the specific version being used.
  17.  
    versions: use-releases searches the pom for all - SNAPSHOT versions which have been released and replaces them with the corresponding release version.
  18.  
    versions: use- next-releases searches the pom for all non- SNAPSHOT versions which have been a newer release and replaces them with the next release version.
  19.  
    versions: use- next- versions searches the pom for all versions which have been a newer version and replaces them with the next version.
  20.  
    バージョンは コミット pom.xml.versionsBackupファイルを削除します。半分フォーム 組み込みを して 「貧者のSCM」
  21.  
    バージョン :元に戻すには、のpom.xmlファイルを復元 から pom.xml.versionsBackupファイル。半分フォーム 組み込みを して 「貧者のSCM」
  22.  
    ちょうど私が思っ dは任意の今後の参考のためにそれを含めます」。

ここで説明する絵を書きます

例えば:

ここで説明する絵を書きます

 

おすすめ

転載: www.cnblogs.com/guohu/p/11330638.html