Pergunta

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.

Foi útil?

Solução

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

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top