Maven properties in site apt files

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

+8
maven maven-2 maven-site-plugin
source share
2 answers

Found. It was just necessary to rename apt files to * .apt.vm. Maven then transfers the files through Velocity, which can handle properties.

+12
source share

My download.apt.vm looks like this:

Download {{${sitePublishUrl}}} 

where 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 period (for example, ${my.repository} ) will not work. This is a speed limit. Instead, use something like ${myRepository} .

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

+5
source share

All Articles