You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2010/08/09 21:50:56 UTC

svn commit: r983797 - in /ant/ivy/core/trunk: ./ doc/use/ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/plugins/parser/m2/ test/java/org/apache/ivy/plugins/parser/m2/

Author: maartenc
Date: Mon Aug  9 19:50:55 2010
New Revision: 983797

URL: http://svn.apache.org/viewvc?rev=983797&view=rev
Log:
IMPROVEMENT: ivy:makepom now has an option to disable the generation of an extra Ivy comment block in the POM

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/doc/use/makepom.html
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-compile-dependencies.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-optional.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-with-scope.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-packaging.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple-dependencies.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple.xml

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Aug  9 19:50:55 2010
@@ -111,6 +111,7 @@ for detailed view of each issue, please 
    trunk
 =====================================
 - IMPROVEMENT: Use IvyAuthenticator only when it is really necessary (IVY-1211)
+- IMPROVEMENT: ivy:makepom now has an option to disable the generation of an extra Ivy comment block in the POM
 - IMPROVEMENT: ivy:makepom now accepts a list of configurations to include (IVY-1005) (thanks to Jesper Pedersen)
 
 - FIX: artifactreport ant task doesn't honor log attribute (IVY-1212)

Modified: ant/ivy/core/trunk/doc/use/makepom.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/use/makepom.html?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/use/makepom.html (original)
+++ ant/ivy/core/trunk/doc/use/makepom.html Mon Aug  9 19:50:55 2010
@@ -44,6 +44,8 @@ An example of use is to publish an Ivy m
         <td>Yes</td></tr>
     <tr><td>conf</td><td>a comma separated list of the configurations to include in the generated pom. Wildcards are supported here. <span class="since">(since 2.2)</span></td><td>No, defaults to all configurations.</td></tr>
 <tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task</td><td>No, 'ivy.instance' is taken by default.</td></tr>
+    <tr><td>printIvyInfo</td><td>Add some information about Ivy to the generated POM. <span class="since">(since 2.2)</span></td>
+        <td>No, defaults to 'true'.</td></tr>
 </tbody>
 </table>
 <h1>Child elements</h1>

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyMakePom.java Mon Aug  9 19:50:55 2010
@@ -60,6 +60,8 @@ public class IvyMakePom extends IvyTask 
     private File pomFile = null;
 
     private File headerFile = null;
+    
+    private boolean printIvyInfo = true;
 
     private String conf;
    
@@ -91,6 +93,14 @@ public class IvyMakePom extends IvyTask 
         this.headerFile = headerFile;
     }
     
+    public boolean isPrintIvyInfo() {
+        return printIvyInfo;
+    }
+
+    public void setPrintIvyInfo(boolean printIvyInfo) {
+        this.printIvyInfo = printIvyInfo;
+    }
+
     public String getConf() {
         return conf;
     }
@@ -130,7 +140,7 @@ public class IvyMakePom extends IvyTask 
     
     private PomWriterOptions getPomWriterOptions() throws IOException {
         PomWriterOptions options = new PomWriterOptions();
-        options.setConfs(splitConfs(conf));
+        options.setConfs(splitConfs(conf)).setPrintIvyInfo(isPrintIvyInfo());
         
         if (mappings.isEmpty()) {
             options.setMapping(PomModuleDescriptorWriter.DEFAULT_MAPPING);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java Mon Aug  9 19:50:55 2010
@@ -23,12 +23,9 @@ import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.module.descriptor.Artifact;
@@ -39,11 +36,6 @@ import org.apache.ivy.util.Configuration
 import org.apache.ivy.util.StringUtils;
 
 public final class PomModuleDescriptorWriter {
-    // used to ease tests only
-    private static boolean addIvyVersion = true;
-    static void setAddIvyVersion(boolean addIvyVersion) {
-        PomModuleDescriptorWriter.addIvyVersion = addIvyVersion;
-    }
 
     private PomModuleDescriptorWriter() {
     }
@@ -60,14 +52,14 @@ public final class PomModuleDescriptorWr
             if (options.getLicenseHeader() != null) {
                 out.print(options.getLicenseHeader());
             }
-            out.println("<!--"); 
-            out.println("   Apache Maven 2 POM generated by Apache Ivy"); 
-            out.println("   " + Ivy.getIvyHomeURL());
-            if (addIvyVersion) {
+            if (options.isPrintIvyInfo()) {
+                out.println("<!--"); 
+                out.println("   Apache Maven 2 POM generated by Apache Ivy"); 
+                out.println("   " + Ivy.getIvyHomeURL());
                 out.println("   Apache Ivy version: " + Ivy.getIvyVersion() 
                     + " " + Ivy.getIvyDate());
+                out.println("-->"); 
             }
-            out.println("-->"); 
             out.println("<project xmlns=\"http://maven.apache.org/POM/4.0.0\" "
                     + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
             out.println("    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 "

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java Mon Aug  9 19:50:55 2010
@@ -25,6 +25,8 @@ public class PomWriterOptions {
     private String licenseHeader;
     
     private ConfigurationScopeMapping mapping;
+    
+    private boolean printIvyInfo = true;
 
     public String[] getConfs() {
         return confs;
@@ -45,6 +47,9 @@ public class PomWriterOptions {
     }
 
     public ConfigurationScopeMapping getMapping() {
+        if (mapping == null) {
+            return PomModuleDescriptorWriter.DEFAULT_MAPPING;
+        }
         return mapping;
     }
 
@@ -52,6 +57,15 @@ public class PomWriterOptions {
         this.mapping = mapping;
         return this;
     }
+
+    public boolean isPrintIvyInfo() {
+        return printIvyInfo;
+    }
+
+    public PomWriterOptions setPrintIvyInfo(boolean printIvyInfo) {
+        this.printIvyInfo = printIvyInfo;
+        return this;
+    }
     
     
     

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriterTest.java Mon Aug  9 19:50:55 2010
@@ -164,12 +164,10 @@ public class PomModuleDescriptorWriterTe
     }
     
     private PomWriterOptions getWriterOptions() {
-        return (new PomWriterOptions()).setLicenseHeader(LICENSE);
+        return (new PomWriterOptions()).setLicenseHeader(LICENSE).setPrintIvyInfo(false);
     }
 
     public void setUp() {
-        // don't add ivy version to se static files for comparison
-        PomModuleDescriptorWriter.setAddIvyVersion(false);
         if (_dest.exists()) {
             _dest.delete();
         }

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-compile-dependencies.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-compile-dependencies.xml?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-compile-dependencies.xml (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-compile-dependencies.xml Mon Aug  9 19:50:55 2010
@@ -17,10 +17,6 @@
    specific language governing permissions and limitations
    under the License.    
 -->
-<!--
-   Apache Maven 2 POM generated by Apache Ivy
-   http://ant.apache.org/ivy/
--->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-optional.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-optional.xml?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-optional.xml (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-optional.xml Mon Aug  9 19:50:55 2010
@@ -17,10 +17,6 @@
    specific language governing permissions and limitations
    under the License.    
 -->
-<!--
-   Apache Maven 2 POM generated by Apache Ivy
-   http://ant.apache.org/ivy/
--->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-with-scope.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-with-scope.xml?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-with-scope.xml (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-dependencies-with-scope.xml Mon Aug  9 19:50:55 2010
@@ -17,10 +17,6 @@
    specific language governing permissions and limitations
    under the License.    
 -->
-<!--
-   Apache Maven 2 POM generated by Apache Ivy
-   http://ant.apache.org/ivy/
--->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-packaging.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-packaging.xml?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-packaging.xml (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-packaging.xml Mon Aug  9 19:50:55 2010
@@ -17,10 +17,6 @@
    specific language governing permissions and limitations
    under the License.    
 -->
-<!--
-   Apache Maven 2 POM generated by Apache Ivy
-   http://ant.apache.org/ivy/
--->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple-dependencies.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple-dependencies.xml?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple-dependencies.xml (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple-dependencies.xml Mon Aug  9 19:50:55 2010
@@ -17,10 +17,6 @@
    specific language governing permissions and limitations
    under the License.    
 -->
-<!--
-   Apache Maven 2 POM generated by Apache Ivy
-   http://ant.apache.org/ivy/
--->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple.xml?rev=983797&r1=983796&r2=983797&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple.xml (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-write-simple.xml Mon Aug  9 19:50:55 2010
@@ -17,10 +17,6 @@
    specific language governing permissions and limitations
    under the License.    
 -->
-<!--
-   Apache Maven 2 POM generated by Apache Ivy
-   http://ant.apache.org/ivy/
--->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">