[
https://jira.codehaus.org/browse/MPDF-66?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=354320#comment-354320
]
Leo Breuss commented on MPDF-66:
--------------------------------
Having a look at the maven-site-plugin source code, they add all the
project.properties to the rendering context. I tried the same on the
maven-pdf-plugin, and it seemed to work. As I don't understand the
maven-pdf-plugin code structure enough, please carefully review my patch so it
doesn't break anything else.
{code}
### Eclipse Workspace Patch 1.0
#P maven-pdf-plugin-1.2
Index: src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
===================================================================
--- src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java (revision
1631529)
+++ src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java (working copy)
@@ -90,6 +90,7 @@
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import javax.swing.text.AttributeSet;
+
import java.io.File;
import java.io.IOException;
import java.io.Reader;
@@ -502,6 +503,13 @@
context.put( "generateTOC", generateTOC );
context.put( "validate", Boolean.valueOf( validate ) );
+ // Put any of the properties in directly into the Velocity context
+ for ( Map.Entry<Object, Object> entry :
project.getProperties().entrySet() )
+ {
+ context.put( (String) entry.getKey(), entry.getValue() );
+ }
+
+
final DocumentModel model = aggregate ? getDocumentModel( locale )
: null;
try
{code}
> custom properties are not filtered in .apt.vm
> ---------------------------------------------
>
> Key: MPDF-66
> URL: https://jira.codehaus.org/browse/MPDF-66
> Project: Maven PDF Plugin
> Issue Type: Bug
> Affects Versions: 1.2
> Reporter: Leo Breuss
>
> The pdf-plugin does not properly filter the .apt.vm files.
> The following site docu fragment works with the site-plugin 3.3 and 3.4, but
> fails with the pdf-plugin.
> {code:title=download.apt.vm}
> Download
> ~~ See
> http://stackoverflow.com/questions/4836564/maven-properties-in-site-apt-files
> {{${release-download-url}}}
> {code}
> {code}
> [INFO] --- maven-pdf-plugin:1.2:pdf (pdf) @ commons-mail ---
> ...
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-pdf-plugin:1.2:pdf (pdf) on project
> commons-mail: Error during document generation: Error parsing
> C:\Users\leo\myproject\target\pdf\site.tmp\apt\download.apt.vm: missing '}'
> -> [Help 1]
> {code}
> See also this stackoverflow question:
> http://stackoverflow.com/questions/18142538/maven-pdf-plugin-custom-properties-are-not-filtered-in-the-generated-pdf
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)