Why Does Gradle Upload to The Wrong Repo?

Why Does Gradle Upload to The Wrong Repo?

Have been struggling with this for a few hours. Despite correctly setting up the upload repo in build.gradle, gradle kept trying to upload to our public repo, which we use for mirroring other repos.
build.gradle:
...
uploadArchives{
	repositories{
		mavenDeployer{
			repository(url:"http://mydtbld0028.isr.hp.com:8081/nexus/content/repositories/releases/"){
				authentication(userName: "deployment", password: "deployment123")
			}
		}
	}
}
...
And after $gradle uploadArchives:
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:uploadArchivesUploading: org/openbakery/xcodePlugin/0.8.1/xcodePlugin-0.8.1.jar to repository remote at https://mydtbld0028.isr.hp.com:8081/nexus/content/repositories/releases/
Error transferring file
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':uploadArchives'.
> Could not publish configuration 'archives'
   > Error deploying artifact 'org.openbakery:xcodePlugin:jar': Error deploying artifact: Error transferring file

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 11.67 secs
Clearly, the wrong repo, which is not even mentioned anywhere in the gradle configuration anywhere on the system is used. After struggling with this, deleting various gradle cache file, discovered that in fact, gradle uses maven configuration in the maven plugin, which it accesses through the M2_HOME environment variable. As described in this post.
I confirm the result and the pledge to document this behavior in gradle documentation.
Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com