[GRADLE-702] Maven deployer uses the repositories specified in the user's settings.xml, rather than those specified in the build file Created: 14/Oct/09  Updated: 04/Jan/13  Resolved: 24/Nov/10

Status: Resolved
Project: Gradle
Affects Version/s: 0.8
Fix Version/s: 0.9-rc-1

Type: Bug
Reporter: Adam Murdoch Assignee: Hans Dockter
Resolution: Fixed Votes: 0


 Comments   
Comment by william wong [ 18/Jan/10 ]

If I use gradle 0.8, what could I do to workaround this issue?

Comment by william wong [ 18/Jan/10 ]

I did some research on this issue and found user's settings.xml was loaded by
org.apache.maven.artifact.ant.DeployTask, which extends org.apache.maven.artifact.ant.AbstractArtifactTask

When DeployTask.createDeploymentArtifactRepository is invoked, DeployTask first updates its repository setting with users' settings file via method updateRepositoryWithSettings.

If there is any mirror defined in user's settings.xml, the mirror setting may override the repository url we provided in gradle file if the id is matched.

Let say, the maven's user settings file (settings.xml) is

...
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://a.b.c/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>nexus-deploy</id>
<mirrorOf>nexus-deploy</mirrorOf>
<url>http://a.b.c/nexus/content/repositories/releases/</url>
</mirror>
</mirrors>
...

And the build.gardle is

...
uploadArchives {
repositories.mavenDeployer

{ name = 'mavenDeployer' repository(url:'http://d.e.f/nexus/content/repositories/releases/',id:'nexus-deploy') }

}
...

Then, the repository url 'http://d.e.f/nexus/content/repositories/releases/' provided in build.gradle will be overrided by the mirror url 'http://a.b.c/nexus/content/repositories/releases/' provided in user's setting file (settings.xml)

Hope the above analyze helps the fix.

Generated at Wed Jun 30 11:36:39 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.