Trouble publishing rpm artifact to yum snapshot repo using Gradle


(Aswin Prakash Thiyagarajan) #1

I’ve been trying to publish a rpm file (built using Gradle-custom plugin) to a yum snapshot repo using Gradle (nexus-yum plugin installed on repo). However, the upload fails and I get an error 400. I further understand that this is because my build script is attempting to upload my rpm artifact to a release repo instead of the snapshot repo. It would be great if anyone could share thoughts as to where I could be going wrong ?


(Peter Niederwieser) #2

Without more information (e.g. all relevant parts of your build script), there isn’t much I can say. Maybe the repository to be used for publishing isn’t configured correctly.


(Aswin Prakash Thiyagarajan) #3

You are right. The problem is that even though i’ve declared snapshot and release repos in my custom upload function, gradle is picking up the maven repo which i’ve declared for the dependencies. Any idea what could be the cause? Whats the suggested way to do this?


(Peter Niederwieser) #4

Again, please show your code. For the suggested way, see the Gradle user guide or one of the samples in the full Gradle distribution.


(Aswin Prakash Thiyagarajan) #5

The relevant portion of code is as below :

repositories{

mavenCentral()

maven url: remote.urlMasterNexus

}

configuration{

deployRpms

}

dependencies{

deployRpms “org apache.maven.wagon:wagon-http:1.0-beta-2”

}

//there is another closure packageRpm which genarates the rpm and the ref is stored to project.ext.rpmFile artifacts{

deployRpms file:project.ext.rpmFile, type: ‘Rpm’

}

uploadDeployRpms{

repositories.mavenDeployer{

configurations = configurations.deployRpms

snapshotRepository (url: remote.urlSnapshotNexus){

authentication(userName: snapshotUser, password: snapshotPwd)

pom.groupId = org.gradleTrial.stock

pom.versionId = ‘0-SNAPSHOT’

}

}

}

– The rpm gets generated successfully. And has the name like archivesBaseName-Date-0-SNAPSHOT.noarch.rpm When I try a maven deploy, gradle picks up the masterUrl instead of the snapshot one. This is the problem I’m facing. Also, I tried doing an ivy upload - that happens properly. So, I’m guessing the problem is with my mavenDeployer approach. It would be great if I could know whats the mistake here as I’d really love to do it the maven way. Thanks!


(Peter Niederwieser) #6

There are some open issues (that we are currently working on) around Gradle not behaving correctly when you configure things only on the mavenDeployer level. Have you tried setting ‘project.version’ to a snapshot version? Likewise, it’s usually better to set ‘project.group’ than ‘pom.groupId’. Also, if you use the same repository for snapshots and releases, then one ‘mavenDeployer.repository’ declaration will do.