Note that there are some explanatory texts on larger screens.

plurals
  1. POassign output of exec-maven-plugin to variable
    primarykey
    data
    text
    <p>I want to use exec-maven-plugin to get git 'revision', so I'm using following configuration:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.2.1&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;gitVersion&lt;/id&gt; &lt;phase&gt;validate&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;exec&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;executable&gt;git&lt;/executable&gt; &lt;workingDirectory&gt;./&lt;/workingDirectory&gt; &lt;arguments&gt; &lt;argument&gt;rev-list&lt;/argument&gt; &lt;argument&gt;master&lt;/argument&gt; &lt;argument&gt;--count&lt;/argument&gt; &lt;/arguments&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre> <p>but I hit a problem - how do I assign output to any variable available in other plugins/livecycles?</p> <p>(I was able to get it done using gmaven-plugin and executing groovy script, but I find it a bit of overkill/less elegant)</p> <p>EDIT: for reference, working solution in groovy:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.codehaus.gmaven&lt;/groupId&gt; &lt;artifactId&gt;gmaven-plugin&lt;/artifactId&gt; &lt;version&gt;1.5&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;validate&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;execute&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;providerSelection&gt;2.0&lt;/providerSelection&gt; &lt;properties&gt; &lt;script&gt;git rev-list master --count&lt;/script&gt; &lt;/properties&gt; &lt;source&gt; def command = project.properties.script def process = command.execute() process.waitFor() def describe = process.in.text.trim() println "setting revision to: " + describe project.properties.setProperty('gitVersion',describe) &lt;/source&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload