maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r1054308 - in /maven/plugins/trunk/maven-changes-plugin/src: main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java site/apt/examples/include-announcement-file.apt.vm site/apt/index.apt site/site.xml
Date Sat, 01 Jan 2011 22:54:35 GMT
Author: dennisl
Date: Sat Jan  1 22:54:35 2011
New Revision: 1054308

URL: http://svn.apache.org/viewvc?rev=1054308&view=rev
Log:
[MCHANGES-160] Support creating a plain text version of the report

o Instead of making a plain text version for the changes-report goal, I opted to make the
announcement-generate goal more configurable. That way you can also include issues from JIRA.

Added:
    maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/include-announcement-file.apt.vm
  (with props)
Modified:
    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/index.apt
    maven/plugins/trunk/maven-changes-plugin/src/site/site.xml

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=1054308&r1=1054307&r2=1054308&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
Sat Jan  1 22:54:35 2011
@@ -74,6 +74,15 @@ public class AnnouncementMojo
     private File outputDirectory;
 
     /**
+     * The name of the file which will contain the generated announcement. If
+     * no value is specified the plugin will use the name of the template.
+     *
+     * @parameter expression="${changes.announcementFile}"
+     * @since 2.4
+     */
+    private String announcementFile;
+
+    /**
      * @parameter expression="${project.groupId}"
      * @readonly
      */
@@ -501,7 +510,7 @@ public class AnnouncementMojo
             }
 
 
-            processTemplate( context, getOutputDirectory(), template );
+            processTemplate( context, getOutputDirectory(), template, announcementFile );
         }
         catch ( ResourceNotFoundException rnfe )
         {
@@ -519,16 +528,23 @@ public class AnnouncementMojo
      * @param context velocity context that has the parameter values
      * @param outputDirectory directory where the file will be generated
      * @param template velocity template which will the context be merged
+     * @param announcementFile The file name of the generated announcement
      * @throws ResourceNotFoundException, VelocityException, IOException
      */
-    public void processTemplate( Context context, File outputDirectory, String template )
+    public void processTemplate( Context context, File outputDirectory, String template,
String announcementFile )
         throws ResourceNotFoundException, VelocityException, MojoExecutionException
     {
         File f;
 
+        // Use the name of the template as a default value
+        if ( StringUtils.isEmpty( announcementFile ) )
+        {
+            announcementFile = template;
+        }
+
         try
         {
-            f = new File( outputDirectory, template );
+            f = new File( outputDirectory, announcementFile );
 
             if ( !f.getParentFile().exists() )
             {

Added: maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/include-announcement-file.apt.vm
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/include-announcement-file.apt.vm?rev=1054308&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/include-announcement-file.apt.vm
(added)
+++ maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/include-announcement-file.apt.vm
Sat Jan  1 22:54:35 2011
@@ -0,0 +1,69 @@
+ ------
+ Include an Announcement File in Your Packaging
+ ------
+ Dennis Lundberg
+ ------
+ 2011-01-01
+ ------
+
+ ~~ Licensed to the Apache Software Foundation (ASF) under one
+ ~~ or more contributor license agreements.  See the NOTICE file
+ ~~ distributed with this work for additional information
+ ~~ regarding copyright ownership.  The ASF licenses this file
+ ~~ to you under the Apache License, Version 2.0 (the
+ ~~ "License"); you may not use this file except in compliance
+ ~~ with the License.  You may obtain a copy of the License at
+ ~~
+ ~~   http://www.apache.org/licenses/LICENSE-2.0
+ ~~
+ ~~ Unless required by applicable law or agreed to in writing,
+ ~~ software distributed under the License is distributed on an
+ ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~~ KIND, either express or implied.  See the License for the
+ ~~ specific language governing permissions and limitations
+ ~~ under the License.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
+
+
+Include an Announcement File in Your Packaging
+
+  Since version 2.4 this plugin has options that allows you to put the generated
+  announcement file anywhere you like. This makes it possible to include the
+  generated announcement in your packaging.
+
+* Configuring the Plugin
+
+  In this example we want to call the generated announcement file
+  <<<CHANGES.txt>>> and have it put into the <<<META-INF>>>
directory of the
+  project's JAR file. To do this we configure the Changes Plugin like this:
+
++-----------------+
+<project>
+  ...
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-changes-plugin</artifactId>
+        <version>${project.version}</version>
+        <configuration>
+          <announcementFile>CHANGES.txt</announcementFile>
+          <outputDirectory>\${project.build.outputDirectory}/META-INF</outputDirectory>
+        </configuration>
+        <executions>
+          <execution>
+            <id>include-announcement-file</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>announcement-generate</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  ...
+</project>
++-----------------+

Propchange: maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/include-announcement-file.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-changes-plugin/src/site/apt/examples/include-announcement-file.apt.vm
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author Id

Modified: maven/plugins/trunk/maven-changes-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/site/apt/index.apt?rev=1054308&r1=1054307&r2=1054308&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/site/apt/index.apt (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/site/apt/index.apt Sat Jan  1 22:54:35 2011
@@ -87,6 +87,8 @@ Maven Changes Plugin
 
   * {{{./examples/customizing-jira-report.html}Customizing the JIRA Report}}
 
+  * {{{./examples/include-announcement-file.html}Include an Announcement File in Your Packaging}}
+
   * {{{./examples/smtp-authentication.html}SMTP authentication}}
 
   * {{{./examples/specifying-mail-sender.html}Specifying the mail sender}}

Modified: maven/plugins/trunk/maven-changes-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/site/site.xml?rev=1054308&r1=1054307&r2=1054308&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/site/site.xml Sat Jan  1 22:54:35 2011
@@ -44,6 +44,7 @@ under the License.
       <item name="Check Your changes.xml File" href="examples/check-changes-file.html"/>
       <item name="Configuring the Trac Report" href="examples/configuring-trac-report.html"/>
       <item name="Customizing the JIRA Report" href="examples/customizing-jira-report.html"/>
+      <item name="Include an Announcement File in Your Packaging" href="examples/include-announcement-file.html"/>
       <item name="SMTP Authentication" href="examples/smtp-authentication.html"/>
       <item name="Specifying the Mail Sender" href="examples/specifying-mail-sender.html"/>
       <item name="Using a Custom Announcement Template" href="examples/using-a-custom-announcement-template.html"/>



Mime
View raw message