I'm using the Build Helper Maven Plugin to construct a property that is the version with "-" for "."... I have it configured as follows:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>regex-property</id>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>webscript.version</name>
<value>${project.version}</value>
<regex>\.</regex>
<replacement>-</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
This works fine when I'm building resources that contain the ${webscript.version}
property (they are correctly substituted as expected within the file), so this is working:
<resource>
<targetPath>./alfresco/site-webscripts/org/alfresco/aikau/${project.version}/webscripts</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/webscripts</directory>
</resource>
However, the problem I'm having is in using the property anywhere else within the project... what I want to do is to use the property for a target folder, like this:
<resource>
<targetPath>./alfresco/site-webscripts/customizations/${webscript.version}</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/extension-webscripts</directory>
</resource>
With this code, the folder created is simply "${webscript.version}" and not "1-0-66" (in the case where the current version is 1.0.66).
Both the working and not-working examples are in the same <build>
element and so I'm assuming are in the same phase.
Can someone advise me on how I can adjust the configuration to get this to work, or to suggest an alternative approach to replacing "." with "-" as a new property that will work in this case?
I was able to work around this using the maven-antrun-plugin with the following execution:
...although I'd still really like to know how to make use of the custom property without needing this step!