maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject [maven-ant-plugin] 40/50: MANT-24:Generate synonum targets named after the archive type for the package target Submitted by: Petteri Räty Reviewed by: Vincent Siveton
Date Wed, 20 Dec 2017 09:26:58 GMT
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-ant-plugin-2.0
in repository https://gitbox.apache.org/repos/asf/maven-ant-plugin.git

commit 9bd2a8bcad268ae621d7489d0e604dd85472ec09
Author: Vincent Siveton <vsiveton@apache.org>
AuthorDate: Thu Feb 1 13:02:01 2007 +0000

    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
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-ant-plugin@502206
13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                |  8 +++-----
 .../org/apache/maven/plugin/ant/AntBuildWriter.java    | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2786ad0..88dd040 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,7 +156,7 @@ under the License.
           <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 @@ under the License.
               </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 @@ under the License.
               </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>
diff --git a/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java b/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
index 9f59a2d..2e0de80 100644
--- a/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
+++ b/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
@@ -822,10 +822,12 @@ public class AntBuildWriter
     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 @@ public class AntBuildWriter
             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 @@ public class AntBuildWriter
         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,

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <commits@maven.apache.org>.

Mime
View raw message