Command line parameters are not being read in the uploadArchives task

(Hemanth) #1


I’m trying to pass an argument from command line into the uploadArchives task to upload artifacts into nexus. The issue is the pom groupid is not able to resolve the command line argument properly. I’m using the following command to run
gradle -Penvironment=dcdev4_106 -Pupload -PuserName=xxx -Ppassword=xxxx uploadArchives

mavenDeployer {
configuration = configurations.archives

    repository(url: ""){
	  if (project.hasProperty('upload')) {
	   authentication(userName: "${userName}", password: "${password}")
    addFilter('artifact1') {artifact, file -> == 'artifact1'
	addFilter('artifact2') {artifact, file -> == 'artifact2'

    println "**** Inside uploading archives for ${environment}"

    pom('artifact1').version = '1.0-SNAPSHOT'

//pom(‘artifact1’).artifactId = '1.0-SNAPSHOT’
pom(‘artifact1’).groupId = 'com.ngs.dcd.${environment}'
I get an error at this line pom(‘artifact1’).groupId = ‘com.ngs.dcd.${environment}’ where $environment argument is not being resolved. I also see it doesn’t throw any error and it is printing fine in the above print statement. The issue is only when passing in pom groupid. Not sure if the arguments cannot be passed into the pom properties or is there any special syntax with this


(Benjamin Muschko) #2

Hi Hemanth,

I saw that you opened the same issue yesterday. Please don’t raise an issue multiple times in the forum. We’ll try to address your issue as soon as we can get around to it.



(Hemanth) #3

Sorry for that. I thought my earlier post has been not been properly posted as i didnt see it in the New topics though i can see that under my activity.

(Hemanth) #4

After making few trails on using appropriate syntax for this, i finally got it working with the following syntax.

pom(‘artifact1’).groupId = ‘com.ngs.dcd’ + ‘.’ +project.getProperties().environment