Question

I'm using maven+gmaven plugin to retrieve some information from Nexus repo. What I'm doing is retrieving build number and trying to set MAVEN property to this value:

def artifactInfo = new XmlSlurper().parseText(version)
def buildNumber = artifactInfo.data.snapshotBuildNumber
println buildNumber
project.properties.setProperty('nexus.buildnumber', buildNumber+1)
println version

But for some reason I'm getting the following error when launching this:

[ERROR] Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.5:execute (default)
on project webclient-installer: groovy.lang.MissingMethodException: No signature of 
method: org.codehaus.gmaven.plugin.execute.GroovyMavenProjectAdapter$
EvaluatingProperties.setProperty() is applicable for argument types: (java.lang.String,
groovy.util.slurpersupport.NodeChildren) values: [mybuildnumber, 134] -> [Help 1]  

Do anybody know what am I doing wrong and why such a straightforward function as setProperty() which works for others doesn't work in my case?

Thanks in advance for your help and explanations!

p.s. It seems I have old gmaven or something where only setProperty(String, NodeChildren) exists.

Était-ce utile?

La solution

A GPath expression such as artifactInfo.data.snapshotBuildNumber is of type groovy.util.slurpersupport.GPathResult, not of type int. You'll have to do something like project.properties.setProperty('mynumber', (buildNumber.text().toInteger()+1).toString()).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top