Details
Description
I've just come across this problem and I believe it's critical. I've searched on JIRA for similar issues and I can't find anything.
I have this configured in my ivysettings.xml:
<credentials host="localhost" realm="Artifactory Realm" username="admin" passwd="password"/>
Which is the default credentials for Artifactory 2.2.5.
I have this resolver as a remote:
<url name="artifactory-snapshots"> <ivy pattern="http://localhost:8081/artifactory/libs-snapshots-local/[organisation]/[module]/[revision]/ivy-[revision].xml" /> <artifact pattern="http://localhost:8081/artifactory/libs-snapshots-local/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" /> </url>
Whenever I attempt to publish, Ivy is reporting this issue:
BUILD FAILED /Users/david/development/tmp/ant/includes/ivy.xml:25: impossible to publish artifacts for com.as#xmltransformer;0.1.0-SNAPSHOT: java.io.IOException: Access to URL http://localhost:8081/artifactory/libs-snapshots-local/com.as/xmltransformer/0.1.0-SNAPSHOT/xmltransformer-0.1.0-SNAPSHOT.jar was refused by the server: User anonymous is not permitted to deploy 'com.as/xmltransformer/0.1.0-SNAPSHOT/xmltransformer-0.1.0-SNAPSHOT.jar' into 'libs-snapshots-local:com.as/xmltransformer/0.1.0-SNAPSHOT/xmltransformer-0.1.0-SNAPSHOT.jar'. at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:79) at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:225) at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82) at org.apache.ivy.util.FileUtil.copy(FileUtil.java:148) at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84) at org.apache.ivy.plugins.repository.AbstractRepository.put(AbstractRepository.java:130) at org.apache.ivy.plugins.resolver.RepositoryResolver.put(RepositoryResolver.java:234) at org.apache.ivy.plugins.resolver.RepositoryResolver.publish(RepositoryResolver.java:216) at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:281) at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:260) at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:172) at org.apache.ivy.Ivy.publish(Ivy.java:600) at org.apache.ivy.ant.IvyPublish.doExecute(IvyPublish.java:311) at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397) at org.apache.tools.ant.Project.executeTarget(Project.java:1366) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1249) at org.apache.tools.ant.Main.runBuild(Main.java:801) at org.apache.tools.ant.Main.startAnt(Main.java:218) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Notice how it is attempting to publish using anonymous credentials.
I am running squid 3.0 on my machine to speed up internet access, but it is an anonymous proxy - there is no username or password required.
Looking at the latest source from svn, in IvyAuthenticator:
String proxyHost = System.getProperty("http.proxyHost"); if (getRequestingHost().equals(proxyHost)) { String proxyUser = System.getProperty("http.proxyUser"); if ((proxyUser != null) && (proxyUser.trim().length() > 0)) { String proxyPass = System.getProperty("http.proxyPassword", ""); Message.debug("authenicating to proxy server with username [" + proxyUser + "]"); result = new PasswordAuthentication(proxyUser, proxyPass.toCharArray()); } } else { Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(), getRequestingHost()); Message.debug("authentication: k='" + Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='" + c + "'"); if (c != null) { result = new PasswordAuthentication(c.getUserName(), c.getPasswd().toCharArray()); } }
What appears to be happening is that the requesting host == localhost, it attempts to get the proxy user, which is subsequently null, it then completely skips over the attempt at line 91 (Credentials c = ...) to retrieve the configured credentials, thus it then attempts to log in anonymously which fails...
I believe anyone running a proxy on their machine (or more seriously I suppose if their company has an anonymous proxy between the developer/build machine and the repository) then as it stands currently, any attempts to publish will fail.
If I can be of any further assistance, please do let me know.
=david=