I use the antrun plugin in my maven assembly to replace the @version @ token in some JSP files with the application version. This is what I do:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<target>
<echo>${displayVersion}</echo>
<replace file="src/main/webapp/admin/decorators/default.jsp" token="@version@" value="${displayVersion}"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
I pass displayVersion as parameter to maven
mvn clean install -DdisplayVersion="Version-1.1"
And this is the console output for the Antrun plugin
[INFO] [antrun:run {execution: default}]
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
main:
[echo] 9.4_70
[INFO] Executed tasks
Although the property is correctly repeated, it is not replaced in my JSP. The current @version @ is replaced with {displayVersion} , not the actual value.
Arpit source
share