You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2007/02/01 14:02:03 UTC

svn commit: r502206 - in /maven/plugins/trunk/maven-ant-plugin: pom.xml src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java

Author: vsiveton
Date: Thu Feb  1 05:02:01 2007
New Revision: 502206

URL: http://svn.apache.org/viewvc?view=rev&rev=502206
Log:
MANT-24:Generate synonum targets named after the archive type for the package target
Submitted by: Petteri Räty
Reviewed by: Vincent Siveton

o applied patch
o bump to maven-invoker-plugin:1.0

Modified:
    maven/plugins/trunk/maven-ant-plugin/pom.xml
    maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java

Modified: maven/plugins/trunk/maven-ant-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/pom.xml?view=diff&rev=502206&r1=502205&r2=502206
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-ant-plugin/pom.xml Thu Feb  1 05:02:01 2007
@@ -156,7 +156,7 @@
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-invoker-plugin</artifactId>
-            <version>1.0-SNAPSHOT</version>
+            <version>1.0</version>
             <configuration>
               <debug>true</debug>
               <projectsDirectory>src/it</projectsDirectory>
@@ -167,8 +167,7 @@
               </pomIncludes>
               <postBuildHookScript>verify.bsh</postBuildHookScript>
               <goals>
-                                  <!-- Install to the target local-repo 
-                -->
+                <!-- Install to the target local-repo -->
                 <goal>install ant:ant</goal>
               </goals>
               <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
@@ -183,8 +182,7 @@
               </execution>
             </executions>
           </plugin>
-                    <!--  Verify the results by calling Ant 
-          -->
+          <!--  Verify the results by calling Ant -->
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-antrun-plugin</artifactId>

Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java?view=diff&rev=502206&r1=502205&r2=502206
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java Thu Feb  1 05:02:01 2007
@@ -822,10 +822,12 @@
     private void writePackageTarget( XMLWriter writer )
         throws IOException
     {
+        String synonym = null; // type of the package we are creating (for example jar)
         AntBuildWriterUtil.writeCommentText( writer, "Package target", 1 );
 
         writer.startElement( "target" );
         writer.addAttribute( "name", "package" );
+
         if ( !AntBuildWriterUtil.isPomPackaging( project ) )
         {
             writer.addAttribute( "depends", "compile,test" );
@@ -848,14 +850,17 @@
             if ( AntBuildWriterUtil.isJarPackaging( project ) )
             {
                 AntBuildWriterUtil.writeJarTask( writer, project );
+                synonym = "jar";
             }
             else if ( AntBuildWriterUtil.isEarPackaging( project ) )
             {
                 AntBuildWriterUtil.writeEarTask( writer, project );
+                synonym = "ear";
             }
             else if ( AntBuildWriterUtil.isWarPackaging( project ) )
             {
                 AntBuildWriterUtil.writeWarTask( writer, project, localRepository );
+                synonym = "war";
             }
             else
             {
@@ -869,6 +874,19 @@
         writer.endElement(); // target
 
         AntBuildWriterUtil.writeLineBreak( writer );
+
+        if ( synonym != null )
+        {
+            AntBuildWriterUtil.writeCommentText( writer,
+                                                 "A dummy target for the package named after the type it creates", 1 );
+            writer.startElement( "target" );
+            writer.addAttribute( "name", synonym );
+            writer.addAttribute( "depends", "package" );
+            writer.addAttribute( "description", "Builds the " + synonym + " for the application " );
+            writer.endElement(); //target
+
+            AntBuildWriterUtil.writeLineBreak( writer );
+        }
     }
 
     private void writeCompileTasks( XMLWriter writer, File basedir, String outputDirectory, List compileSourceRoots,