Question

How can I use maven properties in site APT files? For example I want to use ${project.version} in the index.apt so I can always refer to the latest version without manually changing the index.apt file before deploying the site.

Was it helpful?

Solution

Found it. Just had to rename the apt files to *.apt.vm. Maven then pipes the files through Velocity which can process the properties.

OTHER TIPS

My download.apt.vm looks like this:

Download

{{${sitePublishUrl}}} 

where the pom.xml contains

<properties>
    <sitePublishBase>http://artifactory.foo.com/mvn/libs-release-local</sitePublishBase>
    <sitePublishUrl>${sitePublishBase}/${project.groupId}/${project.artifactId}/${project.version}</sitePublishUrl>
</properties>

Note: custom properties containing a dot (e.g. ${my.repository}) will not work. This is a limitation of Velocity. Instead use something like ${myRepository}.

See also http://maven.apache.org/plugins/maven-site-plugin/examples/creating-content.html#Filtering

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top