使用 Ivy 在 Nexus 中发布时出现凭据错误

Credentials error when publishing in Nexus with Ivy

我试图在发布 post 中找到我的问题的解决方案,但我找不到任何东西(无论是在 Whosebug 还是 google 中)

我正在尝试使用 IVY 将一些工件发布到 Nexus,但我在获取凭据时出错。

在我的 ivysettings.xml 中,我定义了凭据标记,但它不能正常工作(我尝试输入具体用户并通过但不起作用)。如果我将 /nexus 放在主机值中,如下所示:

<ivysettings>
    <settings defaultResolver="nexus"/>
    <credentials host="${host}/nexus" realm="Nexus Repository Manager"
                        username="${user}" passwd="${pass}"/>

    <property name="nexus-public" value="${nexus.url}/content/groups/public"/>
    <property name="nexus-releases" value="${nexus.url}/content/repositories/releases"/>
    <property name="nexus-snapshots" value="${nexus.url}/content/repositories/ricrepo/"/>
    <property name="nexus-other" value="${nexus.url}/content/repositories/releases/"/>


    <resolvers>
            <ibiblio name="nexus" m2compatible="true" usepoms="false" root="${nexus-public}"/>
            <ibiblio name="nexus-releases" m2compatible="true" root="${nexus-releases}"/>
            <ibiblio name="nexus-other" m2compatible="true" root="${nexus-other}"/>
            <ibiblio name="nexus-snapshots" m2compatible="true" root="${nexus-snapshots}" checkmodified="true" 
            changingPattern="*-SNAPSHOT"/>
    </resolvers>
</ivysettings>

${host} 它只是 ${nexus.url} 没有 https:// 前缀并且末尾没有 /nexus

错误是:

[ivy:publish] INFO: Authentication requested but doAuthentication is disabled
Access to URL MYURL was refused by the server

其中 MYURL 是我完整的 URL 与存储库(因此它很好地解析了名称...我认为)

如果我从主机值中删除 de /nexus(ivysettings 如下)

<ivysettings>
    <settings defaultResolver="nexus"/>
    <credentials host="${host}" realm="Nexus Repository Manager"
                        username="${user}" passwd="${pass}"/>

    <property name="nexus-public" value="${nexus.url}/content/groups/public"/>
    <property name="nexus-releases" value="${nexus.url}/content/repositories/releases"/>
    <property name="nexus-snapshots" value="${nexus.url}/content/repositories/ricrepo/"/>
    <property name="nexus-other" value="${nexus.url}/content/repositories/releases/"/>


    <resolvers>
            <ibiblio name="nexus" m2compatible="true" usepoms="false" root="${nexus-public}"/>
            <ibiblio name="nexus-releases" m2compatible="true" root="${nexus-releases}"/>
            <ibiblio name="nexus-other" m2compatible="true" root="${nexus-other}"/>
            <ibiblio name="nexus-snapshots" m2compatible="true" root="${nexus-snapshots}" checkmodified="true" 
            changingPattern="*-SNAPSHOT"/>
    </resolvers>
</ivysettings>

错误是:

[ivy:publish] INFO: No credentials available for BASIC 'Sonatype Nexus Repository Manager'
Access to URL MYURL was refused by the server

拜托,有人可以帮助我吗?

提前致谢!

尝试将领域设置为 "Sonatype Nexus Repository Manager":

<credentials host="${host}" realm="Sonatype Nexus Repository Manager" username="${user}" passwd="${pass}"/>