In Maven, how can I dynamically build a property value at runtime?

Viewed 31682

In maven it is very easy to set properties in a pom with the following syntax:

...
<properties>
  <myValue>4.06.17.6</myValue>
 </properties>
...

Now I need to build a property which depends on the version of my pom. For creating the property i want to do the following (java pseudo code):

String[] parts = version.split("\\.");
String.format("V%s_%s_%s_P%s", splitted[0],  splitted[1],splitted[2],splitted[3]);
// example: 4.06.17.6 => V_4_06_17_P6

It should be dynamic, because it is used as a tag name in our repository and must always be in sync with the version of the artifact.

Any ideas how to create that "dynamic" properties?

3 Answers
Related