Maven exec bash script and save output as property
- by djechlin
I'm wondering if there exists a Maven plugin that runs a bash script and saves the results of it into a property.
My actual use case is to get the git source version. I found one plugin available online but it didn't look well tested, and it occurred to me that a plugin as simple as the one in the title of this post is all I need. Plugin would look something like:
<plugin>maven-run-script-plugin>
<phase>process-resources</phase> <!-- not sure where most intelligent -->
<configuration>
<script>"git rev-parse HEAD"</script> <!-- must run from build directory -->
<targetProperty>"properties.gitVersion"</targetProperty>
</configuration>
</plugin>
Of course necessary to make sure this happens before the property will be needed, and in my case I want to use this property to process a source file.