问题
I have an issue when attempting to retrieve a dependency from a nexus repository when running ant with ivy. the dependency is never resolved, when running with verbose output the suspect line is '[ivy:retrieve] authentication: k='@' c='null'.
I have tried many different variations of providing the credentials configuration to ivy, but without changing the result. Stranger still the repo hostname appears to come from the resolver, not from the provided credentials.
Versions - ANT@1.7.1, IVY@2.1.0, JDK@1.6.0_20
There was a note to ensure that commons-httpclient in on the classpath to allow http authentication, which I am sure it is, although have been unable to confirm explicitly.
Any help is much appreciated.
回答1:
Are you getting a HTTP 401 error? That would indicate problems with the credentials being used to login to Nexus.
Can be fixed by adding a credentials entry in your ivy settings file:
<credentials host="${nexus.host}" realm="Sonatype Nexus Repository Manager" username="${nexus.user}" passwd="${nexus.pass}" />
The gotcha is you need to specify the correct Nexus security realm.
来源:https://stackoverflow.com/questions/3001535/http-authentication-between-using-ant-ivy-retrieving-dependency-from-nexus