Hi Jörg,

I don't think this is correct. The whole idea is that:
- pom projects should stay as they are
- non-pom files should be flattened, meaning mainly resolving dependencies.

so parent, modules, properties and reporting are already included for the first, and should *never* be added to the second.

It's okay to have some flexibility, but IMO these changes would kill the whole idea of the flattened pom.

thanks,
Robert

Op Wed, 15 Oct 2014 22:04:01 +0200 schreef <joerg.hohwil...@codehaus.org>:

Revision:

20066
Author:

joerg.hohwiller
Date:

2014-10-15 15:04:01 -0500 (Wed, 15 Oct 2014)

Log Message

MOJO-2041: implemented, IT still missing

Modified Paths

trunk/mojo/flatten-maven-plugin/src/main/java/org/codehaus/mojo/flatten/FlattenDescriptor.java

trunk/mojo/flatten-maven-plugin/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java

Diff

Modified: trunk/mojo/flatten-maven-plugin/src/main/java/org/codehaus/mojo/flatten/FlattenDescriptor.java
(20065 => 20066)



--- trunk/mojo/flatten-maven-plugin/src/main/java/org/codehaus/mojo/flatten/FlattenDescriptor.java
2014-10-15 19:22:14 UTC (rev 20065)
+++ trunk/mojo/flatten-maven-plugin/src/main/java/org/codehaus/mojo/flatten/FlattenDescriptor.java
2014-10-15 20:04:01 UTC (rev 20066)

@@ -58,6 +58,24 @@

     /** @see #isKeepDistributionManagement() */

     private String distributionManagement;


+    /** @see #isKeepDependencyManagement() */
+    private String dependencyManagement;
+
+    /** @see #isKeepBuild() */
+    private String build;
+
+    /** @see #isKeepParent() */
+    private String parent;
+
+    /** @see #isKeepModules() */
+    private String modules;
+
+    /** @see #isKeepProperties() */
+    private String properties;
+
+    /** @see #isKeepReporting() */
+    private String reporting;
+

     /**

      * The constructor.

      */

@@ -137,10 +155,34 @@

         {

             this.url = "";

         }

+        if ( descriptor.getChild( "dependencyManagement" ) != null )
+        {
+            this.dependencyManagement = "";
+        }
+        if ( descriptor.getChild( "build" ) != null )
+        {
+            this.build = "";
+        }
+        if ( descriptor.getChild( "parent" ) != null )
+        {
+            this.parent = "";
+        }
+        if ( descriptor.getChild( "modules" ) != null )
+        {
+            this.modules = "";
+        }
+        if ( descriptor.getChild( "properties" ) != null )
+        {
+            this.properties = "";
+        }
+        if ( descriptor.getChild( "reporting" ) != null )
+        {
+            this.reporting = "";
+        }

     }


     /**

-     * @return <code>true </code> if we should keep name

+     * @return <code>true</code> if we should keep name

      */

     public boolean isKeepName()

     {

@@ -148,7 +190,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep description

+     * @return <code>true</code> if we should keep description

      */

     public boolean isKeepDescription()

     {

@@ -156,7 +198,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep url

+     * @return <code>true</code> if we should keep url

      */

     public boolean isKeepUrl()

     {

@@ -164,7 +206,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep inceptionYear

+     * @return <code>true</code> if we should keep inceptionYear

      */

     public boolean isKeepInceptionYear()

     {

@@ -172,7 +214,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep organization

+     * @return <code>true</code> if we should keep organization

      */

     public boolean isKeepOrganization()

     {

@@ -180,7 +222,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep scm

+     * @return <code>true</code> if we should keep scm

      */

     public boolean isKeepScm()

     {

@@ -188,7 +230,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep prerequisites

+     * @return <code>true</code> if we should keep prerequisites

      */

     public boolean isKeepPrerequisites()

     {

@@ -196,7 +238,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep developers

+     * @return <code>true</code> if we should keep developers

      */

     public boolean isKeepDevelopers()

     {

@@ -204,7 +246,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep contributors

+     * @return <code>true</code> if we should keep contributors

      */

     public boolean isKeepContributors()

     {

@@ -212,7 +254,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep mailingLists

+     * @return <code>true</code> if we should keep mailingLists

      */

     public boolean isKeepMailingLists()

     {

@@ -220,7 +262,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep repositories

+     * @return <code>true</code> if we should keep repositories

      */

     public boolean isKeepRepositories()

     {

@@ -228,7 +270,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep pluginRepositories

+     * @return <code>true</code> if we should keep pluginRepositories

      */

     public boolean isKeepPluginRepositories()

     {

@@ -236,7 +278,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep issueManagement

+     * @return <code>true</code> if we should keep issueManagement

      */

     public boolean isKeepIssueManagement()

     {

@@ -244,7 +286,7 @@

     }


     /**

-     * @return <code>true </code> if we should keep ciManagement

+     * @return <code>true</code> if we should keep ciManagement

      */

     public boolean isKeepCiManagement()

     {

@@ -252,7 +294,7 @@

     }


     /**

- * @return <code>true </code> if we should keep distributionManagement

+ * @return <code>true</code> if we should keep distributionManagement

      */

     public boolean isKeepDistributionManagement()

     {

@@ -260,6 +302,54 @@

     }


     /**

+     * @return <code>true</code> if we should keep dependencyManagement
+     */
+    public boolean isKeepDependencyManagement()
+    {
+        return this.dependencyManagement != null;
+    }
+
+    /**
+     * @return <code>true</code> if we should keep build
+     */
+    public boolean isKeepBuild()
+    {
+        return this.build != null;
+    }
+
+    /**
+     * @return <code>true</code> if we should keep parent
+     */
+    public boolean isKeepParent()
+    {
+        return this.parent != null;
+    }
+
+    /**
+     * @return <code>true</code> if we should keep modules
+     */
+    public boolean isKeepModules()
+    {
+        return this.modules != null;
+    }
+
+    /**
+     * @return <code>true</code> if we should keep properties
+     */
+    public boolean isKeepProperties()
+    {
+        return this.properties != null;
+    }
+
+    /**
+     * @return <code>true</code> if we should keep reporting
+     */
+    public boolean isKeepReporting()
+    {
+        return this.reporting != null;
+    }
+
+    /**

      * Sets {@link #isKeepName()}.

      */

     public void setKeepName()

@@ -379,4 +469,52 @@

         this.distributionManagement = "";

     }


+    /**
+     * Sets {@link #isKeepDependencyManagement()}.
+     */
+    public void setKeepDependencyManagement()
+    {
+        this.dependencyManagement = "";
+    }
+
+    /**
+     * Sets {@link #isKeepBuild()}.
+     */
+    public void setKeepBuild()
+    {
+        this.build = "";
+    }
+
+    /**
+     * Sets {@link #isKeepParent()}.
+     */
+    public void setKeepParent()
+    {
+        this.parent = "";
+    }
+
+    /**
+     * Sets {@link #isKeepModules()}.
+     */
+    public void setKeepModules()
+    {
+        this.modules = "";
+    }
+
+    /**
+     * Sets {@link #isKeepProperties()}.
+     */
+    public void setKeepProperties()
+    {
+        this.properties = "";
+    }
+
+    /**
+     * Sets {@link #isKeepReporting()}.
+     */
+    public void setKeepReporting()
+    {
+        this.reporting = "";
+    }
+

 }

Modified: trunk/mojo/flatten-maven-plugin/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java
(20065 => 20066)



--- trunk/mojo/flatten-maven-plugin/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java
2014-10-15 19:22:14 UTC (rev 20065)
+++ trunk/mojo/flatten-maven-plugin/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java
2014-10-15 20:04:01 UTC (rev 20066)

@@ -170,8 +170,11 @@

  * {@link Model#getProperties() properties}<br/>

  * {@link Model#getModules() modules}<br/>

  * {@link Model#getReporting() reporting}</td>

- * <td>removed</td>
- * <td>Will be completely stripped and never occur in a flattened POM.</td> </tr>

+ * <td>configurable</td>
+ * <td>These elements should typically be completely stripped from the flattened POM. However for ultimate flexibility + * (e.g. if you only want to resolve variables in a POM with packaging pom) you can also configure to keep these + * elements. We strictly recommend to use this feature with extreme care and only if packaging is pom (for
+ * "Bill of Materials").</td> </tr>

  * </table>

  *

  * @author Joerg Hohwiller (hohwille at users.sourceforge.net)

@@ -625,6 +628,33 @@

         {

             flattenedPom.setUrl( effectivePom.getUrl() );

         }

+        // MOJO-2041
+        if ( descriptor.isKeepDependencyManagement() )
+        {
+ flattenedPom.setDependencyManagement( effectivePom.getDependencyManagement() );
+        }
+        if ( descriptor.isKeepBuild() )
+        {
+ getLog().warn( "Keeping build section in flattened POM this was never inteded by this plugin." );
+            flattenedPom.setBuild( effectivePom.getBuild() );
+        }
+        if ( descriptor.isKeepParent() )
+        {
+ getLog().warn( "Keeping parent section in flattened POM this was never inteded by this plugin." );
+            flattenedPom.setParent( effectivePom.getParent() );
+        }
+        if ( descriptor.isKeepModules() )
+        {
+            flattenedPom.setModules( effectivePom.getModules() );
+        }
+        if ( descriptor.isKeepProperties() )
+        {
+            flattenedPom.setProperties( effectivePom.getProperties() );
+        }
+        if ( descriptor.isKeepReporting() )
+        {
+            flattenedPom.setReporting( effectivePom.getReporting() );
+        }

     }


     /**

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to