문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top