18

何らかの理由で、デフォルトのパブリックグループを介してNexusにSNAPSHOTアーティファクトを提供させることができません。Nexusマニュアルの関連部分を読み、Googleを検索しましたが、何も機能していないようです。

セクション4.2で実装しました。(単一のNexusグループを使用するようにMavenを構成する)ので、私のsettings.xmlは次のようになります。

<settings>

  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://my-server/nexus/content/groups/public</url>
    </mirror>
  </mirrors>

  <profiles>
    <profile>
      <id>nexus</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

</settings>

クリーンなマシン(つまり、SNAPSHOTプロジェクトをビルドしていなかったマシン)でビルドを開始するまではすべて正常に機能し、必要なSNAPSHOT依存関係をダウンロードしませんでした。Mavenは私に次のことを与えます:

[INFO] Scanning for projects...
[INFO]       
[INFO] ------------------------------------------------------------------------
[INFO] Building MyCo Actions Base Classes 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://my-sever/nexus/content/groups/public/com/myco/testing/1.0.0-SNAPSHOT/maven-metadata.xml
Downloading: http://my-sever/nexus/content/groups/public/com/myco/testing/1.0.0-SNAPSHOT/maven-metadata.xml
Downloading: http://my-sever/nexus/content/groups/public/com/myco/testing/1.0.0-SNAPSHOT/testing-1.0.0-SNAPSHOT.pom
[WARNING] The POM for com.myco:testing:jar:1.0.0-SNAPSHOT is missing, no dependency information available
Downloading: http://my-sever/nexus/content/groups/public/com/myco/testing/1.0.0-SNAPSHOT/testing-1.0.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.023s
[INFO] Finished at: Tue Mar 08 15:55:23 GMT 2011
[INFO] Final Memory: 99M/480M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project actions-base: Could not resolve dependencies for project com.myco:actions-base:jar:1.0.0-SNAPSHOT: Could not find artifact com.myco:testing:jar:1.0.0-SNAPSHOT in nexus (http://my-sever/nexus/content/groups/public) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

問題は、testing-1.0.0-SNAPSHOT.jarが存在しないことですが、testing-1.0.0-20110301.182820-1.jarは存在します。NexusにSNAPSHOTを適切に解決させ、JARを提供するにはどうすればよいですか...?

4

4 に答える 4

11

パブリックグループからローカルリリースとスナップショットリポジトリを削除してミラーを作成し、すべてではなくパブリックグループのみをミラーリングすることで、すべてが機能するようになりました。したがって、私のsettings.xmlには次のものが含まれていました。

  <profiles>
    <profile>
      <id>nexus</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>maven-releases</id>
          <url>http://myhost.com/nexus/content/repositories/releases</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>maven-snapshots</id>
          <url>http://myhost.com/nexus/content/repositories/snapshots</url>
          <layout>default</layout>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>        
        <repository>
          <id>madeUp</id>
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>madeUp</id>
          <url>http://central</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>madeUp</mirrorOf>
      <url>http://myhost.com/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
于 2011-07-01T14:49:41.323 に答える
7

ミラーとして機能するようにnexusを構成しているときも、同じ問題が発生します。すべてのリポジトリ(リリースとスナップショット)をパブリックリポジトリグループに追加した後、対応するURLを参照すると、すべてのスナップショットを見つけることができます。

ネクサスを構成する ブラウザパブリックグループ

ただし、このスレッドで説明されているように、Mavenはミラーからスナップショットを取得できません。Mavenは、明示的に指示するまで、ミラーからスナップショットを取得しないことを示しています。解決策として、リポジトリ-Tagと同じURLを追加しましたが、期待どおりに機能します。

<settings>

<mirrors>
    <mirror>
        <id>nexus-mirror</id>
        <name>Nexus Mirror</name>
        <url>http://my-server/nexus/content/groups/public/</url>
        <mirrorOf>*</mirrorOf>
    </mirror>
</mirrors>

<profiles>
    <profile>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>nexus-public</id>
                <name>Nexus Public Repository</name>
                <url>http://my-server/nexus/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </snapshots>
            </repository>
        </repositories>
    </profile>
</profiles>

</settings>

updatePolicy -Tagをミラー全体に設定しても、問題はありません。Mavenは、リリースではなく、すべてのビルドでスナップショットを更新するだけで十分賢いので。

于 2015-04-22T15:11:40.187 に答える
1

私もこれを試しましたが失敗しました。ここに問題の2番目の説明があります。Nexusのパブリックレポが物事を妨害している可能性があります。

最終的に、ローカルスナップショットリポジトリをより直接的に指す2番目のリポジトリをsettings.xmlに追加しました。

<repository>
   <id>ummsSnaps</id>
      <url>https://team/nexus/content/repositories/snapshots</url>
      <snapshots>
         <enabled>true</enabled>
      </snapshots>
</repository>

そしてそれはうまくいった。

于 2011-03-17T18:34:37.120 に答える
0

スナップショットリポジトリがパブリックグループに追加されていることを確認してください。settings.xmlが正しく構成されているように見えるので、/publicにスナップショットリポジトリが含まれていない必要があります。

于 2011-07-01T12:15:36.020 に答える