2013-06-30 47 views
9

最近ArchivaからSonatype Nexusに移行しました。Nexus:アーティファクトが見つかりません

私はサードパーティのリポジトリからJarsを使用しようとしており、Nexusはそれをローカルリポジトリにキャッシュしません。

私はこのセクションの回答を検索しましたが、その質問に答えた人はいませんでした。ここで

は私がsettings.xmlに使用しています...私が何をしたか

です:私も私が使用しているすべてのサードパーティのリポジトリのプロキシリポジトリを作成しました

<settings> 
    <mirrors> 
    <mirror> 
     <!--This sends everything else to /public --> 
     <id>nexus</id> 
     <mirrorOf>*</mirrorOf> 
     <url>http://THE_URL:8080/nexus/content/groups/public</url> 
    </mirror> 
    </mirrors> 
    <servers> 
    <server> 
     <id>admin</id> 
     <username>user</username> 
     <password>password</password> 
    </server> 
    </servers> 
    <profiles> 
    <profile> 
     <id>nexus</id> 
     <!--Enable snapshots for the built in central repo to direct --> 
     <!--all requests to nexus via the mirror --> 
     <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> 
    <activeProfiles> 
    <!--make the profile active all the time --> 
    <activeProfile>nexus</activeProfile> 
    </activeProfiles> 

</settings> 

をし、 NEXUS PUBLIC GROUPに追加されました。

次に、私はコマンドを実行しました:

mvn clean install 

と、次のエラーました:ローカルリポジトリに

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building shlang 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
Downloading: http://THE_URL:8080/nexus/content/groups/public/com/shadow/shadow/1/shadow-1.pom 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 6.341s 
[INFO] Finished at: Sun Jun 30 11:59:42 IDT 2013 
[INFO] Final Memory: 6M/120M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal on project shlang: Could not resolve dependencies for project com.shadow:shlang:jar:1.0-SNAPSHOT: Failed to collect dependencies for [couchbase:couchbase-client:jar:1.1.5 (compile), com.google.code.gson:gson:pom:2.2.2 (compile), org.json:json:jar:20090211 (compile), net.sf.json-lib:json-lib:jar:jdk15:2.4 (compile), jline:jline:jar:2.10 (compile), commons-validator:commons-validator:jar:1.4.0 (compile), spy:spymemcached:jar:2.8.1 (compile), com.shadow:util:jar:1.0.1 (compile), com.shadow:monkey_schoolyard:jar:1.0.0 (compile)]: Failed to read artifact descriptor for com.shadow:util:jar:1.0.1: Could not find artifact com.shadow:shadow:pom:1 in nexus (http://THE_URL:8080/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 

結果は、サードパーティのいずれかが含まれていないということですそれはすべき瓶です。

私はここで何が欠けていますか?

+0

「パブリック」リポジトリグループを「*」のミラーとして設定しました。つまり、すべてのMaven成果物のgoto URLです。取得しようとしているすべての成果物をそのグループのURLから取得できますか?私は推測していない。 –

+1

Mavenの中心にないアーティファクト 'couchbase-client'のリポジトリが不足しているようです。したがって、上記の依存関係を含むリポジトリを追加することを意味する公開リポジトリの構成を変更する必要があります。 – khmarbaise

+0

[Mavenは依存関係を解決できませんでした。アーティファクトを解決できませんでした](http://stackoverflow.com/questions/4650460/maven-could-not-resolve-dependencies-artifacts-could-not-be-resolved) – naXa

答えて

6

ほとんどの場合、ローカルのMavenリポジトリには、コンポーネントがキャッシュされていないことがあります。 Mavenに、スナップショットのバージョンの更新と以前に見つからなかったバージョンの存在を-Uフラグで確認するよう強制することができます。

そうなことは本当に奇妙であれば、それは完全にあなたのローカルリポジトリ内の各フォルダ構造を削除するために助けることができる時々

mvn clean install -U 

を実行します。マンフレッドのソリューションはあなたのために動作しない場合は、あなたの例のように、

rm -rf ~/.m2/repository/com/shadow/ 
2

、その後、問題はネクサスがアーティファクトを解決しようとするとなります。

ブラウザを使用している場合、実際にNexusが行っていることを確認して、後にある成果物を見つけることができます。

追加は、NexusリポジトリのURLにアーティファクトのパスを記述してください。

など。 ネクサスリポジトリ公開リポジトリURL:ORG/SLF4J/SLF4J-API/1.7.5/SLF4J-API-1.7.5:上記のアーティファクトのアーティファクト

<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>slf4j-api</artifactId> 
    <version>1.7.5</version> 
</dependency> 

パスは次のようになりフェッチhttp://my.nexus.server.address:8081/nexus/content/groups/public/

。このプロセスは、その後リポジトリができませんでした理由を示す、リポジトリが指定された順序で、あなたの公開リポジトリグループの下に構成されたリポジトリのリストを進めます

http://my.nexus.server.address:8081/nexus/content/groups/public/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar?describe

をチェックするので、完全なURLを

をjarファイル要求されたアーティファクトを提供する。

ほとんどの理由はわかりやすく、無視することができます。

エラーがまだリポジトリに見つからないとしてキャッシュされていて、がリポジトリ用に取得された場合には、1つの理由があります。

これは、ある時点でNexusがアーティファクトを取得しようとしていて、そのアーティファクトの特定に失敗したことを示しています。

このステータスはNexus内にキャッシュされているようですので、キャッシュを消去する最も簡単な方法はNexusを再起動することです。

関連する問題