Apache Karaf功能:首次运行时repo-add失败,第二次运行成功

时间:2014-12-25 15:07:26

标签: maven nexus apache-karaf karaf pax

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

中的所有内容都已正确说明

〜/ .m2目录/库/ 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阻碍了karaf使maven-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

拜托,我需要你的帮助吗?我该怎样摆脱这个问题?

0 个答案:

没有答案