Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Based upon @Joe suggestion I looked into the build-helper-maven-plugin and was able to come up with the following which does what I need. I wasn't able to identify how to do it all in one step, so I'm doing it in 2. The first step pads the value on the left with zeros. The second step trims the numeric value so that it is only 7 digits long. Please note that ${build.env.version} is passed in as a parameter to the maven build process and that I have defaulted it to 0 in the POM file for when it isn't passed. If you don't provide a default value then the build fails even though failOnError on set to false. </p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;build-helper-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.8&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;stage1--padNumber&lt;/id&gt; &lt;goals&gt; &lt;goal&gt;regex-property&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;name&gt;build.env.version.padded&lt;/name&gt; &lt;value&gt;${build.env.version}&lt;/value&gt; &lt;regex&gt;^([\d]{0,})$&lt;/regex&gt; &lt;replacement&gt;000000$1&lt;/replacement&gt; &lt;failIfNoMatch&gt;false&lt;/failIfNoMatch&gt; &lt;failOnError&gt;false&lt;/failOnError&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;stage2--leftTrimToXcharacters&lt;/id&gt; &lt;goals&gt; &lt;goal&gt;regex-property&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;name&gt;build.env.version.padded&lt;/name&gt; &lt;value&gt;${build.env.version.padded}&lt;/value&gt; &lt;regex&gt;^([\d]*)([\d]{7})$&lt;/regex&gt; &lt;replacement&gt;$2&lt;/replacement&gt; &lt;failIfNoMatch&gt;false&lt;/failIfNoMatch&gt; &lt;failOnError&gt;false&lt;/failOnError&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.
    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