I had a standard easy task: add a "Downloads" page to the maven-generated site, with links to the assemblies generated during the build. Easy task, right?
First step - make maven-assembly-plugin put it's outcome to the site directory - easy :-)
In the maven-assembly-plugin configuration section add:
<outputdirectory>${project.reporting.outputDirectory}/download</outputdirectory>This would put assemblies directly into target/site/download directory, with the name like artifact-name-0.1.0-SNAPSHOT-kind.zip, ready to be linked from the site.Now, lets make a menu item in site.xml in case it is not already there:
<menu name="Overview">
<item name="Download" href="downloads.html">
</item>
</menu>
If the name of the downloaded file didn't change every release, it would be enough to create a downloads.apt file with static links to download directory and that's all. This was the way I did it in my previous project. I configured assembly to skip the VERSION part of the generated file name and it was it.
This time, I wanted the file name to retain the version information, so after looking at the maven-site-plugin help (at the bottom) I decided to rename the file to downloads.apt.vm and try the VM support for apt. (I could have used an Expression in site.xml and be done...)
VM support appeared in the 2.0-beta-6 version of the site plugin, but I use the latest Maven 2.0.8, so the right version should be just downloaded, right?
Wrong.
In the master-master-pom included by master-pom included by my pom, the site plugin is set to 2.0-beta5 (thank you, maven help:effective-pom :-) ). Somebody must have decided it is nice to have the latest site plugin back then.
OK, so now the downloads.apt.vm is actually parsed.
I have put the ${pom.version} in the file, hoping it would resolve to my 0.10-SNAPSHOT. No way - it doesn't. So I tried a few variations - no help.
But hey - they say it works for them! Either they lie, or there is another gotcha I just don't see.
I wish I had a second pair of eyes then, but we don't pair program for just a quick config change (we should with maven).
apt.vm's apparently are not filtered with project properties, just custom ones. After taking a glimpse of supposedly working POM/apt.vm pair, I added the required <properties> to my pom:
<properties>
<currentVersion>${project.version}</currentVersion>
<artifactZip>${project.build.finalName}.zip</artifactZip>
<downloadDir>download</downloadDir>
</properties>
Now it works as I wanted.














