Reputation: 5399
Here is one more question...
I'm trying to get maven project.artifactId from within groovy script. That's seems to be not so easy, though. Here is the code I use:
String getArtifactName() {
String artifactName = project.properties.getProperty('project.artifactId')
if (artifactName == null || artifactName == "") {
println artifactName
println "[ERROR] Unable to parse artifact path."
println "[ERROR] Artifact won't be uploaded on the target server."
} else {
println artifactName
return artifactName
}
}
It ends up with error and with artifactName==null
. However, if I define some user defined property, say user
, it is parsed wonderfully.
Is there my mistakes or it is a restriction of maven/gmaven/groovy?
Thanks in advance for you help!
p.s. Any workarounds are acceptable as well.
Upvotes: 1
Views: 1441
Reputation: 5399
Thanks to gmaven mail list I was able to resolve this. It seems that built-in maven variables/properties are not accessable through the project.properties.getProperty()
funciton. To get such a properties from the project we need to use just project.artifactId
for maven artifactId
variable
Upvotes: 1