nexus - 无法上传到快照存储库

时间:2014-10-13 16:57:32

标签: maven nexus

我安装了OSS Nexus实例,并且我正在尝试将我的工件放入其snapshotsreleases存储库(托管存储库)中。我正在使用deployment用户凭据(我更改了密码)。现在,问题是我可以部署到releases但无法部署到snapshots。如果我在版本为mvn deploy的工件上运行1.2.3 - 它部署得很好,但如果我向其添加-SNAPSHOT并尝试使用完全相同< / em>凭据,它给我回错401.根据Nexus故障排除知识库文章,这意味着要么没有发送凭据,要么它们无效。但是他们发送了 - 我用-X运行了Maven并显示了这个用户,两个部署都是相同的。日志中没有任何内容可以提供有关问题发生原因的任何提示。实际上,在这个日志中根本没有任何东西。

有关正在发生的事情以及如何解决问题的任何想法?

更新1:似乎我的Nexus实例无法处理快照上传。当我在快照版本上运行mvn deploy时,实际发布的内容类似于:/nexus/content/repositories/snapshots/com/myorg/myapp/1.2.3-SNAPSHOT/myapp-1.2.3-2014101.1234-1.jar。但Nexus只是没有处理它,甚至没有检查身份验证。

但是当我尝试将其手动发布为/nexus/content/repositories/snapshots/com/myorg/1.2.3-SNAPSHOT/myapp-1.2.3-SNAPSHOT.jar时 - 它有效!因此,这些自动生成的版本似乎会导致此问题。现在,Maven在distributionManagement/snapshotRepository/uniqueVersion中有一个设置pom.xml,它应该控制这种行为,但它在Maven 3中不起作用。

更新2:我的settings.xml

<servers>
    <server>
      <id>s1</id>
      <username>deployment2</username>
      <password>****</password>
    </server>       
    <server>
        <id>releases</id>
        <username>deployment2</username>
        <password>****</password>
    </server>       
</servers>

我的pom.xml

<distributionManagement>
    <snapshotRepository>
        <id>s1</id>
        <url>http://myserv:15999/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
        <id>releases</id>
        <url>http://myserv:15999/nexus/content/repositories/releases</url>
    </repository>
</distributionManagement>   

Nexus中Snapshots存储库的设置:

Repository ID: snapshots
Repository Name: Snapshots
Repository Type: hosted
Provider: Maven2
Format: maven2
Repository Policy: Snapshot
Default Local Storage Location: file:/home/me/sonatype-work/nexus/storage/snapshots/
Override Local Storage Location: 
Deployment Policy: Allow Redeploy
Allow File Browsing: True
Include in Search: True
Publish URL: True
Not Found Cache TTL: 1440 minutes

更新3:所以我使用FINE日志级别运行了maven并获取了快照:

Oct 16, 2014 6:17:32 PM sun.net.www.protocol.http.HttpURLConnection writeRequests
FINE: sun.net.www.MessageHeader@1b9199bc6 pairs: {PUT /nexus/content/repositories/snapshots/com/myorg/myapp/0.13.23-SNAPSHOT/myapp-0.13.23-20141016.151730-1.war HTTP/1.1: null}{User-Agent: Apache-Maven/3.1.0 (Java 1.7.0_55; Windows 7 6.1)}{Host: myserv:15999}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}{Content-Length: 29473552}
Oct 16, 2014 6:17:32 PM sun.net.www.protocol.http.HttpURLConnection getInputStream
FINE: sun.net.www.MessageHeader@37aea9528 pairs: {null: HTTP/1.1 401 Unauthorized}{Date: Thu, 16 Oct 2014 15:17:31 GMT}{Server: Nexus/2.10.0-02}{X-Frame-Options: SAMEORIGIN}{X-Content-Type-Options: nosniff}{Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Wed, 15-Oct-2014 15:17:31 GMT}{WWW-Authenticate: BASIC realm="Sonatype Nexus Repository Manager"}{Content-Length: 0}
Oct 16, 2014 6:17:32 PM sun.net.www.protocol.http.HttpURLConnection$1 run
FINEST: Requesting Authentication: host =myserv url = http://myserv:15999/nexus/content/repositories/snapshots/com/myorg/myapp/0.13.23-SNAPSHOT/myapp-0.13.23-20141016.151730-1.war
Oct 16, 2014 6:17:32 PM sun.net.www.protocol.http.HttpURLConnection$1 run
FINEST: Authentication returned: null
Oct 16, 2014 6:17:32 PM sun.net.www.protocol.http.HttpURLConnection getServerAuthentication
FINER: Server Authentication for AuthenticationHeader: prefer BASIC realm="Sonatype Nexus Repository Manager" returned null

对于发布:

Oct 16, 2014 6:42:20 PM sun.net.www.protocol.http.HttpURLConnection writeRequests
FINE: sun.net.www.MessageHeader@4e90dc46 pairs: {PUT /nexus/content/repositories/releases/com/myorg/myapp/0.13.24/myapp-0.13.24.war HTTP/1.1: null}{User-Agent: Apache-Maven/3.1.0 (Java 1.7.0_55; Windows 7 6.1)}{Host: myserv:15999}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}{Content-Length: 29473533}
Oct 16, 2014 6:42:21 PM sun.net.www.protocol.http.HttpURLConnection getInputStream
FINE: sun.net.www.MessageHeader@60b5fe698 pairs: {null: HTTP/1.1 401 Unauthorized}{Date: Thu, 16 Oct 2014 15:42:20 GMT}{Server: Nexus/2.10.0-02}{X-Frame-Options: SAMEORIGIN}{X-Content-Type-Options: nosniff}{Set-Cookie: rememberMe=deleteMe; Path=/nexus; Max-Age=0; Expires=Wed, 15-Oct-2014 15:42:20 GMT}{WWW-Authenticate: BASIC realm="Sonatype Nexus Repository Manager"}{Content-Length: 0}
Oct 16, 2014 6:42:21 PM sun.net.www.protocol.http.HttpURLConnection$1 run
FINEST: Requesting Authentication: host =myserv url = http://myserv:15999/nexus/content/repositories/releases/com/myorg/myapp/0.13.24/myapp-0.13.24.war
Oct 16, 2014 6:42:21 PM sun.net.www.protocol.http.HttpURLConnection$1 run
FINEST: Authentication returned: java.net.PasswordAuthentication@62b1fb50
Oct 16, 2014 6:42:21 PM sun.net.www.protocol.http.HttpURLConnection getServerAuthentication
FINER: Server Authentication for AuthenticationHeader: prefer BASIC realm="Sonatype Nexus Repository Manager" returned sun.net.www.protocol.http.BasicAuthentication@51774036

如您所见,为版本返回身份验证信息,但不为快照返回身份验证信息。我看不出我能做错什么,你看到了我的配置,这很简单。有什么想法吗?

0 个答案:

没有答案