I\'m running an external groovy script via gmaven plugin in pom.xml. The external script is say \'myscript.groovy\'.
I want to provide some parameters/arguments to m
There are two ways you can bind and retrieve properties. One would be through plugin-specific properties.
org.codehaus.gmaven
gmaven-plugin
generate-resources-execute-groovyscript
generate-resources
execute
${installation.dir}
These would be retrieved in the script like project.properties['installation.dir']
.
GMaven isn't maintained anymore (I was the last maintainer). If you want to use versions of Groovy newer than 2.0.0, have a look at GMavenPlus. Here's the equivalent POM:
org.codehaus.gmavenplus
gmavenplus-plugin
1.5
execute
generate-resources
false
installation.dir
${installation.dir}
org.codehaus.groovy
groovy-all
2.4.3
runtime
Retrieval in this case would be like properties['installation.dir']
. I know the file:///
is annoying. I've removed the requirement for that in the next release.
For GMaven or GMavenPlus, if you choose the plugin properties approach, you will need to set the value elsewhere either with something like this in your project POM
C:\someDir
Or include it in your call like mvn -Dinstallation.dir=C:\someDir
The other option is to bind to project level properties directly. You would put it in your project level properties or in your call, like mentioned above, and don't include
in the plugin
. If you go this route, you'd access in your script by project.properties['installation.dir']
for either GMaven or GMavenPlus (also take out
for GMavenPlus in this case).
If this doesn't work for you, try renaming installation.dir
to something like installationDir
. I can't remember offhand if periods were problematic.