0
votes

I am using Ivy to build my project which has several components. I want to upload these components to Nexus 2.6.4

I am able to publish files to Nexus using curl and the default user name and password:

curl -i -v -u deployment:deployment123 --upload-file a.txt http://myserver:8081/nexus/content/repositories/releases/acp/myproject.app/1.0.0.20160622175545/a.txt

This works perfectly fine! When I go on the Nexus UI to System Feeds: Authorization and Authentication section, I can see a successful connection took place.

When I change the password to a wrong password, I can see a failed connection attempt in the Authorization and Authentication feed.

However, when I build my project using Ant I hit Unauthorized (sounds like 401). and I see absolutely nothing in the Nexus feed (this means no credentials were sent according to the Nexus documentation).

ivysettings.xml:

<ivysettings>
    <settings defaultBranch="${ivy.deliver.branch}" defaultResolver="default-chain" />
    <properties file="${ivy.settings.dir}/build.properties" />
    <credentials host="${repo.host}" realm="${repo.realm}"
    username="${repo.user}" passwd="${repo.pass}" />

    <resolvers>
        <filesystem name="local" transactional="true">
        <ivy
            pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[branch]/[revision]/ivy-[revision].xml" />
            <artifact
            pattern="${ivy.default.ivy.user.dir}/local/[organisation]/[module]/[branch]/[revision]/[type]s/[artifact]-[revision].[ext]" />
        </filesystem>
        <ibiblio name="nexus" m2compatible="true" root="${nexus-public}" />
        <ibiblio name="nexus-releases" m2compatible="true" root="${nexus-releases}" />
        <chain name="default-chain">
            <resolver ref="local" />
            <resolver ref="nexus" />
        </chain>
    </resolvers>
</ivysettings>

build.properties contains (among other things):

repo.host=myserver
repo.port=8081
repo.user=deployment
repo.pass=deployment123
repo.realm=Nexus Repository Manager
bundle.publish.resolver=nexus-releases

Any ideas?

1
I think your realm may be incorrect. Try: "Sonatype Nexus Repository Manager". - Mark O'Connor
Thank you, Mark. That was the problem indeed! - MisterStrickland
Can you post that as an answer so I can accept it? - MisterStrickland

1 Answers

2
votes

The realm was incorrect. The right value is Sonatype Nexus Repository Manager. The realm isn't necessary for using curl but it is when authenticating from Ant.