2012-05-15 20 views
5

HTTPS経由で利用できるNexusがあります。許可されたユーザーのみがアクセス権を持ちます。 Mavenを使用して、必要なすべてのアーティファクトがローカルリポジトリにある場合、アーティファクトを展開することもできます。しかし、ローカルリポジトリから必要なアーティファクトを削除すると、ビルドに失敗します。MavenはHTTPS Nexusから必須認証をダウンロードできません

<settings> 
<pluginGroups> 
    </pluginGroups> 
    <proxies> 
    </proxies> 
    <mirrors> 
     <mirror> 
     <id>nexus</id> 
     <mirrorOf>*</mirrorOf> 
     <url>https://example.com/nexus/content/groups/all</url> 
     </mirror> 
    </mirrors> 

    <profiles> 
     <profile> 

      <id>nexus</id> 

      <properties> 
       <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonardb?useUnicode=true&amp;characterEncoding=utf8</sonar.jdbc.url> 
       <sonar.jdbc.driverClassName>com.mysql.jdbc.Driver</sonar.jdbc.driverClassName> 
       <sonar.jdbc.username>sonarusername</sonar.jdbc.username> 
       <sonar.jdbc.password>sonarpw</sonar.jdbc.password> 
       <sonar.host.url>http://localhost:9000/</sonar.host.url> 
      </properties> 


      <repositories> 
       <repository> 
        <id>central</id> 
        <url>https://example.com/nexus/content/groups/all</url> 
        <releases><enabled>true</enabled></releases> 
        <snapshots><enabled>true</enabled></snapshots> 
       </repository> 
      </repositories> 
      <pluginRepositories> 
       <pluginRepository> 
        <id>central</id> 
        <url>https://example.com/nexus/content/groups/all</url> 
        <releases><enabled>true</enabled></releases> 
        <snapshots><enabled>true</enabled></snapshots> 
       </pluginRepository> 
      </pluginRepositories> 

     </profile> 
    </profiles> 

    <servers> 
     <server> 
      <id>all</id> 
      <username>user</username> 
      <password>pw</password> 
     </server> 
     <server> 
      <id>releases</id> 
      <username>user</username> 
      <password>pw</password> 
     </server> 
     <server> 
      <id>snapshots</id> 
      <username>user</username> 
      <password>pw</password> 
     </server> 
    </servers> 

    <activeProfiles> 
     <activeProfile>nexus</activeProfile> 
    </activeProfiles> 

</settings> 

私はwgetのを使用して、このネクサスからアーティファクトをダウンロードし、私はに--no-チェック証明書のキーを追加する必要がありました:

Downloading: https://example.com/nexus/content/groups/all/org/springframework/spring-test-mvc/1.0.0.BUILD-SNAPSHOT/spring-test-mvc-1.0.0.BUILD-SNAPSHOT.pom 
[INFO] ------------------------------------------------------------------------ 
[INFO] Reactor Summary: 
[INFO] 
[INFO] example - project1 ..................................... SUCCESS [0.500s] 
[INFO] example - project2 ..................................... FAILURE [2.951s] 
[INFO] example - project3 ...................................... SKIPPED 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 3.599s 
[INFO] Finished at: Tue May 15 13:58:13 EEST 2012 
[INFO] Final Memory: 6M/121M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal on project example - project2: Could not resolve dependencies for project com.example:example-project:jar:1.2.0-SNAPSHOT: Failed to collect dependencies for [com.example:example-project:jar:1.2.0-SNAPSHOT (compile), org.springframework:spring-beans:jar:3.1.1.RELEASE (compile), org.springframework:spring-context:jar:3.1.1.RELEASE (compile), org.springframework:spring-core:jar:3.1.1.RELEASE (compile), org.springframework:spring-test:jar:3.1.1.RELEASE (test), org.springframework:spring-web:jar:3.1.1.RELEASE (compile), org.apache.httpcomponents:httpclient:jar:4.1.1 (test), org.codehaus.jackson:jackson-mapper-asl:jar:1.9.6 (compile), org.springframework:spring-test-mvc:jar:1.0.0.BUILD-SNAPSHOT (test), junit:junit:jar:4.10 (test), org.mockito:mockito-all:jar:1.9.0 (test), org.hamcrest:hamcrest-all:jar:1.1 (compile), org.slf4j:slf4j-api:jar:1.6.1 (compile), org.slf4j:slf4j-log4j12:jar:1.6.1 (compile), log4j:log4j:jar:1.2.16 (compile), log4j:apache-log4j-extras:jar:1.1 (compile)]: Failed to read artifact descriptor for org.springframework:spring-test-mvc:jar:1.0.0.BUILD-SNAPSHOT: Could not transfer artifact org.springframework:spring-test-mvc:pom:1.0.0.BUILD-SNAPSHOT from/to nexus (https://example.com/nexus/content/groups/all): Not authorized, ReasonPhrase:Unauthorized. -> [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 
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command 
[ERROR] mvn <goals> -rf :grc-webclient-services 

私のユーザーのsettings.xml内の以下の内容がありますサーバーの証明書をスキップする(自己署名しているため)、その後はwgetを使用してダウンロードできます。

私はJavaキー-Dsun.security.ssl.allowUnsafeRenegotiation = trueを設定しましたが、何も変更しませんでした。

はその後、私はコマンドを使用して、信頼リストにサーバの証明書を追加しました原因それは多分自己署名証明書の問題ではないことが判明:

keytool -keystore $JAVA_HOME/jre/lib/security/cacerts -import -file certificate.cer 

誰かが私からアーティファクトをダウンロードすることができますどのようなアイデアを持っていますビルド時のNexus?

+0

ニース説明を追加します。しかし、あなたは、[このガイド](HTTP試してみました://maven.apache .org/guides/mini/guide-repository-ssl.html)? – Paaske

+0

前回のコメントが必要なものかどうかはわかりません。自己署名証明書を持つサーバー上のリポジトリにアクセスするだけであれば、証明書をJavaキーストアに追加するだけで十分です。 – Paaske

+0

私はすでに1つを追加しました。正しい方法ではないかもしれません。証明書が追加されたことを確認するまた、Nexusに接続しているときにWireSharkを使用してトラフィックを分析したところ、SSL Content-Type:Alert(21)のEncription Alertパッケージが表示されます。 –

答えて

4

私は 'ネクサス' はのsettings.xmlの上で私のミラーの識別子である

<server> 
     <id>nexus</id> 
     <username>user</username> 
     <password>pw</password> 
    </server> 

<server> 
     <id>all</id> 
     <username>user</username> 
     <password>pw</password> 
    </server> 

を変更しなければなりませんでした。

-3

ワゴン-HTTP-軽量延長、ロシアの一部が:-)を理解するために少し大変でした

Best solution to maven proxy configure

+1

ユーザーが読むために別のサイトにリンクするのではなく、答えの本文に内容と説明を追加してください – Crowie

関連する問題