2011-09-07 13 views
18

私はmavenを使用してプロジェクトをリリースしようとしていますが、リリースリポジトリにリリースする代わりにスナップショットリポジトリに配置します。Mavenはリリースの代わりにスナップショットにデプロイします

私のポンポンは次のようになります。

<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
          http://maven.apache.org/maven-v4_0_0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<groupId>com.example.my.profiler</groupId> 
<artifactId>profilerlib</artifactId> 
<name>Profiler Lib</name> 
<version>1.0.2-SNAPSHOT</version> 
<description>Profiler Library</description> 
<scm> 
    <connection>scm:svn:https://svn.example.com/my-project/profilerlib/trunk 
    </connection> 
    <developerConnection>scm:svn:https://svn.example.com/my-project/profilerlib/trunk 
    </developerConnection> 
</scm> 
<distributionManagement> 
    <!-- Publish the versioned releases here --> 
    <repository> 
     <id>nexus</id> 
     <name>nexus</name> 
     <url>http://repo.example.com:8081/nexus/content/repositories/releases 
     </url> 
    </repository> 
    <!-- Publish the versioned releases here --> 
    <snapshotRepository> 
     <id>nexus</id> 
     <name>nexus</name> 
     <url>http://repo.example.com:8081/nexus/content/repositories/snapshots 
     </url> 
    </snapshotRepository> 
</distributionManagement> 
<!-- download artifacts from this repo --> 
<repositories> 
    <repository> 
     <id>nexus</id> 
     <name>EXAMPLE Public Repository</name> 
     <url>http://repo.example.com:8081/nexus/content/groups/public</url> 
     <releases> 
      <enabled>true</enabled> 
     </releases> 
     <snapshots> 
      <enabled>true</enabled> 
     </snapshots> 
    </repository> 
</repositories> 
<dependencies> 
    ... 
</dependencies> 
<build> 
    <finalName>${project.artifactId}</finalName> 
    <plugins> 
     <plugin> 
      <artifactId>maven-release-plugin</artifactId> 
      <configuration> 
       <tagBase>https://svn.example.com/my-project/profilerlib/tags 
       </tagBase> 
      </configuration> 
     </plugin> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <powermock.version>1.4.6</powermock.version> 
</properties> 
</project> 
+0

この問題の解決策はありますか? – mihn

+0

私はpom.xmlに別々のリポジトリとsnapShotRepository ID値を定義する必要がありましたが、以前はIIRCでした。 –

答えて

11
<repository> 
    <id>nexus</id><!--etc--> 
</repository> 
<snapshotRepository> 
    <id>nexus</id><!--etc--> 
</snapshotRepository> 
<!-- etc --> 
<repositories> 
    <repository> 
     <id>nexus</id> 
     <!-- etc --> 
    </repository> 
</repositories> 

これは、3つの異なるリポジトリに同じIDを使用している問題です。 MavenはこれらのリポジトリをIDで管理しているので、各IDは一意でなければなりません!例えば。 「nexus-releases」、「nexus-snapshots」、および「nexus」を使用します。

+0

チップをありがとう、私は同じ問題を抱えています。 Mavenの出力ヘルプ? –

+3

問題を解決しなかった場合、これはなぜ受け入れられた答えですか? – Ken

+0

@Ken両方の回答は有効ですが、彼らは問題が何であるかの2つの異なる側面を示しています。多分2人で一緒に問題を解決しましたか? –

12

POMは、バージョン番号をSNAPSHOTバージョンとして示しています。したがって、この状態のPOMでmvn deployを実行した場合、スナップショットリポジトリにスナップショットが自動的に展開されます。

リリースを行うには、の目標を使用する必要があります。


一方、あなたはすでにこれを知っているかもしれませんが、本当の答えはSean Patrick Floydの答えです。

+0

母、私は明らかに(+1)を見落としました! –

+0

私は走っています:mvn release:準備リリース:mvn deployを実行しないでください。 リリースプラグインは、展開する前に-SNAPSHOTサフィックスを削除する必要がありますか? –

+1

@ user932509準備が実行中の成果物(邪悪になる)のバージョンを変更することが疑わしいので、準備と実行を別々のステップで実行する必要があります。 –

19

誰がこの問題を抱えて、既存の答えは自分の問題を解決しない見つけた場合には:

release:prepareがリリースタグを作成する前にgitリポジトリにコミットしていないことを意味するバグの一握りがありました。つまり、release:performが検出するpomファイルのバージョン番号には-SNAPSHOTが含まれており、デプロイヤはスナップショットリポジトリに解放しようとします。 MRELEASE-875は(2.5に影響を及ぼし、2.5.1で修正された)別の原因でこの問題の

+0

これはまさに私の問題でした、ありがとう!何らかの理由でMavenが壊れた2.5のリリースを受け取りました。 POMのバージョンを指定して2.5.1(http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin/2.5.1)を選択するように強制しました。 –

+0

これを確認してください!どうもありがとうございます。 'maven-release-plugin'の' 2.5'バージョンを表示している[ヘルプページ](https://maven.apache.org/guides/mini/guide-releasing.html)が見つかりました。私はちょうど[ML](http://mail-archives.apache.org/mod_mbox/maven-users/201507.mbox/thread)にメールを送って、このページを更新するように頼んでいます。 – boly38

2

フェルファウル...リリース - プラグインがあることを確認してください。

ここでは、この動作を担当する最新の欠陥があります同じ名前のブランチではなく、タグをチェックアウトします。

私はちょうどこれに惑わされました... "1.9.0"というブランチを作成してリリースし、mvn releaseを実行しました。これも "1.9.0"タグを作成しました。 mvn release:runを実行すると、 "1.9.0"のgit checkoutが実行され、1.9.0ブランチのHEADを取得しました(もちろん、スナップショットは1.10-SNAPSHOTでした)。

これは私の人生の2時間です。私は戻ってこないでしょう...将来的には、支店名に "-release"という接尾辞を追加します(例: "1.9.0-release")。

関連する問題