Gradle upload caught by nexus mirror attempts to upload to public groups instead of snapshot


(Peter Kahn) #1

How to I force gradle to use the appropriate upload URL for my nexus snapshot repo regardless of the mirror setting? Maven handles this fine downloading from mirror group and uploading to snapshot id. Gradle uses the mirror to upload and gets a 400 error.

Please let me know where i’m going wrong.

Thanks

Peter

build.gradle

apply plugin: 'maven'
group = 'my.group'
artifactId = 'autobuild'
// from gradle.properties
version = version
  uploadArchives {
    repositories.mavenDeployer {
            repository(id: "snapshots", url:'http://my.internal.nexus/nexus/content/repositories/snapshots') {
              authentication(userName: "user", password: "password")
            }
            pom.version = project.version
            pom.artifactId = project.artifactId
    }

settings.xml

<mirrors>
    <mirror>
      <id>internal-repository</id>
      <name>MyCorp Nexus Maven2 Public Group</name>
      <url>http://my.internal.nexus/nexus/content/groups/public</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
  <profiles>
      <profile>
      <id>default-profile</id>
      <repositories>
        <repository>
          <id>releases</id>
          <url>http://my.internal.nexus/nexus/content/repositories/releases</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>snapshots</id>
          <url>http://my.internal.nexus/nexus/content/repositories/snapshots</url>
          <releases>
            <enabled>false</enabled>
          </releases>
        </repository>

(Peter Niederwieser) #2

Gradle itself has no concept of “mirror”. Are you saying that ‘gradle uploadArchives’ is trying to use the mirror declared in Maven’s ‘settings.xml’? I’d be surprised if it did.


(dorin.dragan-sassler) #3

Hello Peter,

we have an jenkins server to build artifacts and upload to nexus with maven. I created a jenkins job to build artifacs and upload to nexus with gradle, but I have the same problem. The nexus repository from build.gradle is ignored and the mirror nexus repository from settings.xml is used. I get 400 error.


(Peter Niederwieser) #4

Sounds like a regression. I’ve filed GRADLE-2877.