Gradle overrides local mavenDeployer settings for uploadArchives when mirror is defined in settings.xml

(joakim.l.lindberg) #1


I have a problem where gradle overrides my local mavenDeployer repository settings in build.gradle when I have a mirror defined in the maven settings.xml file. I’ve tried to remove the mirror settings and then it works without any problems. Is there a workaround for this that does not involve changing the settings.xml file?

This regards the uploadArchive task.

All input is appreciated.

(Stuart Armitage) #2

Perhaps related - Gradle appears to be loading the system maven configuration twice for me.

When running in debug mode, I see four settings files loaded.

  1. gradle empty settings 2) M2_HOME/conf/settings.xml 3) USER_HOME/.m2/settings.xml 4) M2_HOME/conf/settings.xml

I replaced the system settings.xml with my user settings.xml, and gradle is now using the correct settings.

(René Groeschke) #3

unfortunately I can’t reproduce the problem locally. I’ve defined a mirror in ~/.m2/settings.xml and in M2_HOME/conf/settings.xml and in my test project this does not affect the url mavenDeployer settings in my uploadArchive task.

Can you possibly share a settings.xml you’re using and provide the gradle debug output of the uploadArchives task?


(Stuart Armitage) #4

I’ve created the following Gist -

If this settings.xml is located in my user area, then the proxy setting is ignored, and I receive the following message:

Error deploying artifact ‘bob:rita:gradle’: Error deploying artifact: Error transferring file Connection timed out: connect

If it is located in the system area, then the proxy setting is retained, and I receive the following message:

Error deploying artifact ‘bob:rita:gradle’: Error deploying artifact: Failed to transfer file: Return code is: 405

If I run in debug mode, I see “Maven Ant Tasks version: 2.1.3” loading four settings.xml files, as detailed above.

It appears that the last one wins.

(joakim.l.lindberg) #5

My problem is similar but I have a mirror defined in my M2HOME/conf/settings.xml

When I change the mirrorOf to not mirror * then it works fine. It seems to me like the settings.xml has precedence over whatever is defined in build.gradle.

(René Groeschke) #6

I can reproduce this with the following settings.xml:

      <name>UK Central</name>

(ramesh862020) #7


I am facing the same issue now. Do we have a fix for this issue yet?

Any guidance is appreciated. Thanks.