2

我在 Apache Karaf 3.0.2 中有一个烦人的问题。我想添加一个功能存储库。它位于我的私人 Nexus 快照存储库中,并受用户名和密码保护。一切都在我的settings.xml

~/.m2/repository/settings.xml:

<servers>
    <server>
        <id>test</id>
        <username>karaf</username>
        <password>karafpass</password>
    </server>
</servers>

org.ops4j.pax.url.mvn.cfg:

org.ops4j.pax.url.mvn.repositories= \
http://repo1.maven.org/maven2@id=central, \
http://repository.springsource.com/maven/bundles/release@id=spring.ebr.release, \
http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external, \
http://zodiac.springsource.com/maven/bundles/release@id=gemini, \
http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases, \
https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@norelease, \
https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases, \
http://192.168.178.25:8081/nexus/content/repositories/snapshots@id=test@snapshots@noreleases

添加功能存储库的命令:

feature:repo-add mvn:com.test/com.test.feature/1.0.0-SNAPSHOT/xml/features

在第一次尝试中,我得到:

Error executing command: Error resolving artifact com.test:com.test.feature:xml:features:1.0.0-SNAPSHOT: 
Could not find artifact com.test:com.test.feature:xml:features:1.0.0-SNAPSHOT in apache (http://repository.apache.org/content/groups/snapshots-group/)

为什么会失败?错误陈述是正确的,但为什么在我的 Snapshot-Repository 中找不到工件?这是我在 Nexus 中可以看到的内容request.log

192.168.178.25 - - [25/Dez/2014:15:44:40 +0100] "GET /nexus/content/repositories/snapshots/com/test/com.test.feature/1.0.0-SNAPSHOT/maven-metadata.xml HTTP/1.1" 401 0
192.168.178.25 - - [25/Dez/2014:15:44:43 +0100] "GET /nexus/content/repositories/snapshots/com/test/com.test.feature/1.0.0-SNAPSHOT/com.test.feature-1.0.0-SNAPSHOT-features.xml HTTP/1.1" 401 0
192.168.178.25 - - [25/Dez/2014:15:44:43 +0100] "GET /nexus/content/repositories/snapshots/com/test/com.test.feature/1.0.0-SNAPSHOT/com.test.feature-1.0.0-SNAPSHOT-features.xml HTTP/1.1" 404 1289

问题在于401第一行阻碍了 karafmaven-metadata.xml正确形成后续命令。为什么?所有凭据都是我的 M2 的一部分settings.xml,请使用它们!

使用相同命令的下一次尝试成功并且request.log说:

192.168.178.25 - - [25/Dez/2014:15:59:02 +0100] "GET /nexus/content/repositories/snapshots/com/test/com.test.feature/1.0.0-SNAPSHOT/maven-metadata.xml HTTP/1.1" 200 1029
192.168.178.25 - - [25/Dez/2014:15:59:02 +0100] "GET /nexus/content/repositories/snapshots/com/test/com.test.feature/1.0.0-SNAPSHOT/maven-metadata.xml.sha1 HTTP/1.1" 200 40
192.168.178.25 - - [25/Dez/2014:15:59:03 +0100] "GET /nexus/content/repositories/snapshots/com/test/com.test.feature/1.0.0-SNAPSHOT/com.test.feature-1.0.0-20141224.100146-1-features.xml HTTP/1.1" 200 1086
192.168.178.25 - - [25/Dez/2014:15:59:04 +0100] "GET /nexus/content/repositories/snapshots/com/test/com.test.feature/1.0.0-SNAPSHOT/com.test.feature-1.0.0-20141224.100146-1-features.xml.sha1 HTTP/1.1" 200 40

请问,我需要你的帮助吗?我怎样才能摆脱这个问题?

4

0 回答 0