You can use project filtering to process the JSP as it is copied to the target location. If the JSP is specified with ${project.version}
, and the containing folder is specified as a filter location the value should be substituted into the JSP as it is packaged.
For example, adding this to your POM enables filtering for src/main/resources:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
Update: for war packaging, you may need to configure the war plugin to do its filtering. See the Filtering
section of the war-plugin's documentation for more details and examples.
Essentially the process is the same, but it is defined below the war plugin, so you'd have something like this:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
<configuration>
<webResources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…