Author: rfscholte
Date: Fri Jun 22 16:38:07 2012
New Revision: 1352964

URL: http://svn.apache.org/viewvc?rev=1352964&view=rev
Log:
Fix  MCHANGES-176: Make ConversionTool available in the VelocityContext

Modified:
    maven/plugins/trunk/maven-changes-plugin/pom.xml
    
maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/template-directory/test-announce.vm
    
maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/verify.bsh
    
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
    
maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/using-a-custom-announcement-template.apt.vm

Modified: maven/plugins/trunk/maven-changes-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/pom.xml?rev=1352964&r1=1352963&r2=1352964&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-changes-plugin/pom.xml Fri Jun 22 16:38:07 2012
@@ -286,6 +286,11 @@ under the License.
       <artifactId>velocity</artifactId>
       <version>1.7</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity-tools</artifactId>
+      <version>2.0</version>
+    </dependency>
 
     <!-- schema validation dependencies : jaxp 1.3 is not included with jdk 
1.4 (start with 1.5) -->
     <dependency>

Modified: 
maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/template-directory/test-announce.vm
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/template-directory/test-announce.vm?rev=1352964&r1=1352963&r2=1352964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/template-directory/test-announce.vm
 (original)
+++ 
maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/template-directory/test-announce.vm
 Fri Jun 22 16:38:07 2012
@@ -1,3 +1,5 @@
 The ${developmentTeam} is pleased to announce the ${finalName} release!
 
-${introduction}
\ No newline at end of file
+${introduction}
+
+$date.systemDate
\ No newline at end of file

Modified: 
maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/verify.bsh?rev=1352964&r1=1352963&r2=1352964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/verify.bsh
 (original)
+++ 
maven/plugins/trunk/maven-changes-plugin/src/it/announcement-generate-custom-template/verify.bsh
 Fri Jun 22 16:38:07 2012
@@ -48,6 +48,14 @@ try
       System.err.println( "Test Announcement Custom template" );
       return false;
     }
+    
+    indexOf = reportContent.indexOf( "$date.systemDate" );
+    if ( indexOf >= 0 )
+    {
+      System.err.println( "$date.systemDate not resolved" );
+      return false;
+    }
+    
 
 }
 catch( Throwable e )

Modified: 
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java?rev=1352964&r1=1352963&r2=1352964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
 Fri Jun 22 16:38:07 2012
@@ -36,19 +36,19 @@ import org.apache.maven.plugin.changes.R
 import org.apache.maven.plugin.issues.Issue;
 import org.apache.maven.plugin.issues.IssueManagementSystem;
 import org.apache.maven.plugin.issues.IssueUtils;
-import org.apache.maven.plugin.jira.JiraDownloader;
 import org.apache.maven.plugin.jira.JIRAIssueManagmentSystem;
+import org.apache.maven.plugin.jira.JiraDownloader;
 import org.apache.maven.plugin.trac.TracDownloader;
 import org.apache.maven.plugin.trac.TracIssueManagmentSystem;
 import org.apache.maven.plugins.changes.model.Release;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
 import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.context.Context;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.tools.ToolManager;
 import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.velocity.VelocityComponent;
@@ -547,7 +547,8 @@ public class AnnouncementMojo
     {
         try
         {
-            Context context = new VelocityContext();
+            ToolManager toolManager = new ToolManager( true );
+            Context context = toolManager.createContext();
 
             if ( getIntroduction() == null || getIntroduction().equals( "" ) )
             {

Modified: 
maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/using-a-custom-announcement-template.apt.vm
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/using-a-custom-announcement-template.apt.vm?rev=1352964&r1=1352963&r2=1352964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/using-a-custom-announcement-template.apt.vm
 (original)
+++ 
maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/using-a-custom-announcement-template.apt.vm
 Fri Jun 22 16:38:07 2012
@@ -143,6 +143,9 @@ Using a Custom Announcement Template
 *-----------------+----------+-----------+-----------------+
 <Variables marked with * are read-only.>
 
+ Since 2.8 the Velocity Context contains all default tools as provided by the 
{{{http://velocity.apache.org/tools/devel/standalone.html}ToolManager}}.
+ See the {{{http://velocity.apache.org/tools/devel/summary.html}Tools Usage 
Summary}} for further details. 
+
  For information on how to access variables in your template and more,
  please see the
  
{{{http://velocity.apache.org/engine/releases/velocity-1.4/user-guide.html}Velocity
 user guide}}.


Reply via email to