You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2016/09/24 15:19:23 UTC

[01/33] maven git commit: [MNG-6057] Problem with CI friendly usage of ${..} reactor order is changed o Based on the missing replacement of the versions ${revision} ${changelist} or ${sha1} within the parent element the order of the reactor change

Repository: maven
Updated Branches:
  refs/heads/MNG-6056-feature-toggle 4298b5187 -> 626a0406b


[MNG-6057] Problem with CI friendly usage of ${..} reactor order is
changed
 o Based on the missing replacement of the versions ${revision}
   ${changelist} or ${sha1} within the parent element the order
   of the reactor changes.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/dca6a2cc
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/dca6a2cc
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/dca6a2cc

Branch: refs/heads/MNG-6056-feature-toggle
Commit: dca6a2cceca575d05c1c4bcdfea9edf7ef83a17e
Parents: c2018a4
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Tue Sep 29 11:46:48 2015 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Tue Jul 5 22:26:20 2016 +0200

----------------------------------------------------------------------
 .../model/building/DefaultModelBuilder.java     | 32 ++++++++++++++++++--
 1 file changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/dca6a2cc/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 06ee1fa..6eccffa 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -74,6 +74,8 @@ import org.apache.maven.model.superpom.SuperPomProvider;
 import org.apache.maven.model.validation.ModelValidator;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.interpolation.MapBasedValueSource;
+import org.codehaus.plexus.interpolation.StringSearchInterpolator;
 
 import static org.apache.maven.model.building.Result.error;
 import static org.apache.maven.model.building.Result.newResult;
@@ -915,13 +917,37 @@ public class DefaultModelBuilder
         // save profile activations before interpolation, since they are evaluated with limited scope
         Map<String, Activation> originalActivations = getProfileActivations( model, true );
 
-        Model result = modelInterpolator.interpolateModel( model, model.getProjectDirectory(), request, problems );
-        result.setPomFile( model.getPomFile() );
+        Model interpolatedModel = modelInterpolator.interpolateModel( model, model.getProjectDirectory(), request, problems );
+        if ( interpolatedModel.getParent() != null )
+        {
+            StringSearchInterpolator ssi = new StringSearchInterpolator();
+            ssi.addValueSource( new MapBasedValueSource( request.getUserProperties() ) );
+
+            ssi.addValueSource( new MapBasedValueSource( model.getProperties() ) );
+
+            ssi.addValueSource( new MapBasedValueSource( request.getSystemProperties() ) );
+
+            try
+            {
+                String interpolated = ssi.interpolate( interpolatedModel.getParent().getVersion() );
+                interpolatedModel.getParent().setVersion( interpolated );
+            }
+            catch ( Exception e )
+            {
+                ModelProblemCollectorRequest mpcr = new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+                    .setMessage(
+                                "Failed to interpolate field: " + interpolatedModel.getParent().getVersion() + " on class: "
+                                    ).setException(e );
+                problems.add( mpcr );
+            }
+
+        }
+        interpolatedModel.setPomFile( model.getPomFile() );
 
         // restore profiles with file activation to their value before full interpolation
         injectProfileActivations( model, originalActivations );
 
-        return result;
+        return interpolatedModel;
     }
 
     private ModelData readParent( Model childModel, ModelSource childSource, ModelBuildingRequest request,


[13/33] maven git commit: [MNG-3507] use released maven-shared-utils for colorized message API

Posted by kh...@apache.org.
[MNG-3507] use released maven-shared-utils for colorized message API

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/32ce3492
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/32ce3492
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/32ce3492

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 32ce34921cc3d71c4216781de4a574037fad532f
Parents: f848bc2
Author: Herv� Boutemy <hb...@apache.org>
Authored: Tue Jul 26 23:13:56 2016 +0200
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Tue Jul 26 23:14:55 2016 +0200

----------------------------------------------------------------------
 maven-embedder/src/site/apt/index.apt.vm | 4 ++++
 pom.xml                                  | 2 +-
 src/site/xdoc/index.xml                  | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/32ce3492/maven-embedder/src/site/apt/index.apt.vm
----------------------------------------------------------------------
diff --git a/maven-embedder/src/site/apt/index.apt.vm b/maven-embedder/src/site/apt/index.apt.vm
index 519fdae..9b8daff 100644
--- a/maven-embedder/src/site/apt/index.apt.vm
+++ b/maven-embedder/src/site/apt/index.apt.vm
@@ -40,3 +40,7 @@ ${project.name}
    * <<<.mvn/maven.config>>> containing Maven command-line parameter,
 
    * <<<.mvn/extensions.xml>>> containing {{{./core-extensions.html}a list of extensions}}.
+
+ * since 3.4.0, output is colorized by default, with color disabled in batch mode: see
+   {{{/shared/maven-shared-utils/apidocs/org/apache/maven/shared/utils/logging/package-summary.html}styled message API}}
+   for more details.

http://git-wip-us.apache.org/repos/asf/maven/blob/32ce3492/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c447507..861b915 100644
--- a/pom.xml
+++ b/pom.xml
@@ -289,7 +289,7 @@ under the License.
       <dependency>
         <groupId>org.apache.maven.shared</groupId>
         <artifactId>maven-shared-utils</artifactId>
-        <version>3.1.0-SNAPSHOT</version>
+        <version>3.1.0</version>
       </dependency>
       <dependency>
         <groupId>org.fusesource.jansi</groupId>

http://git-wip-us.apache.org/repos/asf/maven/blob/32ce3492/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index a1a7f73..61b105d 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -57,7 +57,7 @@
           <area shape="rect" coords="409,342,500,378" alt="maven-model" href="maven-model/" />
           <area shape="rect" coords="88,59,192,94"    alt="slf4j-api" href="http://www.slf4j.org/manual.html" />
           <area shape="rect" coords="551,58,707,94"   alt="commons-cli" href="http://commons.apache.org/cli/" />
-          <area shape="rect" coords="88,175,205,211"  alt="maven-project-utils" href="https://maven.apache.org/shared/maven-shared-utils/" />
+          <area shape="rect" coords="88,175,205,211"  alt="maven-shared-utils" href="https://maven.apache.org/shared/maven-shared-utils/" />
           <area shape="rect" coords="0,176,70,211"    alt="jansi" href="http://fusesource.github.io/jansi/" />
           <area shape="rect" coords="0,229,71,266"    alt="jansi-native" href="https://github.com/fusesource/jansi-native" />
           <area shape="rect" coords="551,116,739,152" alt="wagon-provider-api" href="https://maven.apache.org/wagon/wagon-provider-api/" />


[05/33] maven git commit: Language style improvements for commit 5dab4940c9a7d3b362bd2a8b078b183e4eb521bb

Posted by kh...@apache.org.
Language style improvements for commit 5dab4940c9a7d3b362bd2a8b078b183e4eb521bb


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/96a75579
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/96a75579
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/96a75579

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 96a75579567efd52927f559ce811528c3e4429fc
Parents: 5dab494
Author: Michael Osipov <mi...@apache.org>
Authored: Sun Jul 10 18:27:17 2016 +0200
Committer: Michael Osipov <mi...@apache.org>
Committed: Sun Jul 10 18:27:17 2016 +0200

----------------------------------------------------------------------
 maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/96a75579/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index eeb22c6..79f5819 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -533,11 +533,11 @@ public class MavenCli
 
         if ( slf4jLogger.isDebugEnabled() )
         {
-            slf4jLogger.debug( "message scheme: " + ( MessageUtils.isColor() ? "color" : "plain" ) );
+            slf4jLogger.debug( "Message scheme: " + ( MessageUtils.isColor() ? "color" : "plain" ) );
             if ( MessageUtils.isColor() )
             {
                 MessageBuffer buff = MessageUtils.buffer();
-                buff.a( "message styles: " );
+                buff.a( "Message styles: " );
                 buff.debug().a( "debug" ).reset().a( ' ' );
                 buff.info().a( "info" ).reset().a( ' ' );
                 buff.warning().a( "warning" ).reset().a( ' ' );


[12/33] maven git commit: [MNG-5670] guard against ConcurrentModificationException [MNG-6053] guard against key without value

Posted by kh...@apache.org.
[MNG-5670] guard against ConcurrentModificationException
[MNG-6053] guard against key without value


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/f848bc20
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/f848bc20
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/f848bc20

Branch: refs/heads/MNG-6056-feature-toggle
Commit: f848bc20f90ff25f5585f3f9515de65dfe12779a
Parents: 3d11173
Author: Christian Schulte <sc...@apache.org>
Authored: Mon Jul 25 19:53:27 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Mon Jul 25 19:53:27 2016 +0200

----------------------------------------------------------------------
 .../internal/MavenRepositorySystemUtils.java    | 28 ++++++++++++++------
 1 file changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/f848bc20/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
index 17cbc6d..fa009f7 100644
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
+++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
@@ -19,6 +19,9 @@ package org.apache.maven.repository.internal;
  * under the License.
  */
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.util.Properties;
 
 import org.eclipse.aether.DefaultRepositorySystemSession;
@@ -128,18 +131,27 @@ public final class MavenRepositorySystemUtils
         session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
 
         // MNG-5670 guard against ConcurrentModificationException
-        Properties sysProps = new Properties();
-        for ( String key : System.getProperties().stringPropertyNames() )
+        // MNG-6053 guard against key without value
+        final Properties systemProperties = new Properties();
+        // This relies on the fact that load/store are synchronized internally.
+        try ( final ByteArrayOutputStream out = new ByteArrayOutputStream() )
         {
-            Object value = System.getProperty( key );
-            // MNG-6053 guard against key without value
-            if ( value != null )
+            System.getProperties().store( out, null );
+            out.close();
+
+            try ( final ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() ) )
             {
-                sysProps.put( key, value );
+                systemProperties.load( in );
+                in.close();
             }
         }
-        session.setSystemProperties( sysProps );
-        session.setConfigProperties( sysProps );
+        catch ( final IOException e )
+        {
+            throw new AssertionError( "Unexpected IO error copying system properties." );
+        }
+
+        session.setSystemProperties( systemProperties );
+        session.setConfigProperties( systemProperties );
 
         return session;
     }


[11/33] maven git commit: [MNG-6053] prevent NPE when copying System Properties in MavenRepositorySystemUtils

Posted by kh...@apache.org.
[MNG-6053] prevent NPE when copying System Properties in MavenRepositorySystemUtils

Signed-off-by: Fred Bricon <fb...@gmail.com>

This closes #90


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/3d111735
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/3d111735
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/3d111735

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 3d111735310c4630d6e805ca8cd3916afcf66802
Parents: 6d9ffe3
Author: Fred Bricon <fb...@gmail.com>
Authored: Mon Jul 25 19:15:30 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Mon Jul 25 19:44:45 2016 +0200

----------------------------------------------------------------------
 .../maven/repository/internal/MavenRepositorySystemUtils.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/3d111735/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
index 3a98b2a..17cbc6d 100644
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
+++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
@@ -131,7 +131,12 @@ public final class MavenRepositorySystemUtils
         Properties sysProps = new Properties();
         for ( String key : System.getProperties().stringPropertyNames() )
         {
-            sysProps.put( key, System.getProperty( key ) );
+            Object value = System.getProperty( key );
+            // MNG-6053 guard against key without value
+            if ( value != null )
+            {
+                sysProps.put( key, value );
+            }
         }
         session.setSystemProperties( sysProps );
         session.setConfigProperties( sysProps );


[22/33] maven git commit: [MNG-6075] Increase the model validation level to the next minor level version.

Posted by kh...@apache.org.
[MNG-6075] Increase the model validation level to the next minor level version.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/3681fd84
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/3681fd84
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/3681fd84

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 3681fd8489cd59d0c5bc49ef38725b655d524301
Parents: 3628e96
Author: Christian Schulte <sc...@apache.org>
Authored: Sun Jul 31 17:51:19 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sun Jul 31 17:51:19 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/model/building/ModelBuildingRequest.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/3681fd84/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java
index 8b51d45..ac0f8b8 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java
@@ -55,14 +55,15 @@ public interface ModelBuildingRequest
     int VALIDATION_LEVEL_MAVEN_3_0 = 30;
 
     /**
-     * Denotes validation as performed by Maven 3.1. This validation level is meant for new projects.
+     * Denotes validation as performed by Maven 3.1. This validation level is meant for new projects. As of Maven 3.4,
+     * this is the default validation level.
      */
     int VALIDATION_LEVEL_MAVEN_3_1 = 31;
 
     /**
      * Denotes strict validation as recommended by the current Maven version.
      */
-    int VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_0;
+    int VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_1;
 
     /**
      * Gets the raw model to build. If not set, model source will be used to load raw model.


[06/33] maven git commit: [MNG-5878] project.directory property can override artifactId in url inheritance

Posted by kh...@apache.org.
[MNG-5878] project.directory property can override artifactId in url
inheritance

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/14182b82
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/14182b82
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/14182b82

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 14182b82fc63ec61ff771f5ba3b8c0a0babeadfd
Parents: 96a7557
Author: Herv� Boutemy <hb...@apache.org>
Authored: Tue Jul 12 22:57:35 2016 +0200
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Tue Jul 12 22:58:44 2016 +0200

----------------------------------------------------------------------
 maven-model/src/main/mdo/maven.mdo | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/14182b82/maven-model/src/main/mdo/maven.mdo
----------------------------------------------------------------------
diff --git a/maven-model/src/main/mdo/maven.mdo b/maven-model/src/main/mdo/maven.mdo
index 313fd19..03c6583 100644
--- a/maven-model/src/main/mdo/maven.mdo
+++ b/maven-model/src/main/mdo/maven.mdo
@@ -245,7 +245,7 @@
           <description>
             <![CDATA[
             The URL to the project's homepage.
-            <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
+            <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if 
             project's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>
@@ -2174,7 +2174,7 @@
             <a href="https://maven.apache.org/scm/scm-url-format.html">URL format</a>
             and <a href="https://maven.apache.org/scm/scms-overview.html">list of supported SCMs</a>.
             This connection is read-only.
-            <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
+            <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if 
             scm's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>
@@ -2187,7 +2187,7 @@
             <![CDATA[
             Just like <code>connection</code>, but for developers, i.e. this scm connection
             will not be read only.
-            <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
+            <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if 
             scm's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>
@@ -2206,7 +2206,7 @@
           <description>
             <![CDATA[
             The URL to the project's browsable SCM repository, such as ViewVC or Fisheye.
-            <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
+            <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if 
             scm's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>
@@ -2673,7 +2673,7 @@
           <description>
             <![CDATA[
             The url of the location where website is deployed, in the form <code>protocol://hostname/path</code>.
-            <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
+            <br /><b>Default value is</b>: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if 
             site's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>


[14/33] maven git commit: [MNG-5670] guard against ConcurrentModificationException [MNG-6053] guard against key without value

Posted by kh...@apache.org.
[MNG-5670] guard against ConcurrentModificationException
[MNG-6053] guard against key without value


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/53077505
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/53077505
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/53077505

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 53077505a7e9408565ec30a43ad243c41189a94e
Parents: 32ce349
Author: Christian Schulte <sc...@apache.org>
Authored: Thu Jul 28 17:20:20 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Thu Jul 28 17:21:10 2016 +0200

----------------------------------------------------------------------
 .../maven/repository/internal/MavenRepositorySystemUtils.java    | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/53077505/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
----------------------------------------------------------------------
diff --git a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
index fa009f7..877c277 100644
--- a/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
+++ b/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
@@ -137,17 +137,15 @@ public final class MavenRepositorySystemUtils
         try ( final ByteArrayOutputStream out = new ByteArrayOutputStream() )
         {
             System.getProperties().store( out, null );
-            out.close();
 
             try ( final ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() ) )
             {
                 systemProperties.load( in );
-                in.close();
             }
         }
         catch ( final IOException e )
         {
-            throw new AssertionError( "Unexpected IO error copying system properties." );
+            throw new AssertionError( "Unexpected IO error copying system properties.", e );
         }
 
         session.setSystemProperties( systemProperties );


[09/33] maven git commit: [MNG-6068] Document default scope compile in XSD o Added information about default scope in XSD comment.

Posted by kh...@apache.org.
[MNG-6068] Document default scope compile in XSD
 o Added information about default scope in XSD comment.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/90f26c27
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/90f26c27
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/90f26c27

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 90f26c279af9738735be8f84f60dcf21b6244e24
Parents: 5fb4bc9
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Mon Jul 18 11:56:40 2016 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Mon Jul 18 12:34:17 2016 +0200

----------------------------------------------------------------------
 maven-model/src/main/mdo/maven.mdo | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/90f26c27/maven-model/src/main/mdo/maven.mdo
----------------------------------------------------------------------
diff --git a/maven-model/src/main/mdo/maven.mdo b/maven-model/src/main/mdo/maven.mdo
index 03c6583..976fa89 100644
--- a/maven-model/src/main/mdo/maven.mdo
+++ b/maven-model/src/main/mdo/maven.mdo
@@ -1430,7 +1430,7 @@
             It also assists in determining which artifacts to include in a distribution of
             this project. For more information, see
             <a href="https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">the
-            dependency mechanism</a>.
+            dependency mechanism</a>. If no scope is given the scope is <code>compile</code>.
             ]]>
           </description>
           <type>String</type>


[31/33] maven git commit: Improved.

Posted by kh...@apache.org.
Improved.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/c4e94a27
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/c4e94a27
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/c4e94a27

Branch: refs/heads/MNG-6056-feature-toggle
Commit: c4e94a27e138f090b275096d49d12b292df01aa8
Parents: 1b3edcc
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Fri Jul 15 20:06:45 2016 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Fri Aug 12 22:50:47 2016 +0200

----------------------------------------------------------------------
 .../maven/feature/ActivatedFeatureToggles.java  | 90 ++++++++++++++++++++
 .../maven/feature/DefaultFeatureToggles.java    |  3 +
 2 files changed, 93 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/c4e94a27/maven-feature/src/main/java/org/apache/maven/feature/ActivatedFeatureToggles.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/main/java/org/apache/maven/feature/ActivatedFeatureToggles.java b/maven-feature/src/main/java/org/apache/maven/feature/ActivatedFeatureToggles.java
new file mode 100644
index 0000000..7bc1cdc
--- /dev/null
+++ b/maven-feature/src/main/java/org/apache/maven/feature/ActivatedFeatureToggles.java
@@ -0,0 +1,90 @@
+package org.apache.maven.feature;
+
+import java.util.Arrays;
+import java.util.List;
+
+/*
+ * 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.
+ */
+
+/**
+ * This enumeration contains those features which are activated by default.
+ * Those features can be deactivated via <code>--deactivate-features MNGXXXX</code>.
+ * 
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
+ *
+ * @since 3.4.0
+ */
+public enum ActivatedFeatureToggles
+{
+
+    //FIXME: Only some examples given. Nothing which exists in reality.
+
+    /**
+     * MNG8000 this feature toggle is intended to do the following.. 
+     */
+    MNG8000( "MNG-8000", "This feature is activated by default and can only "
+        + "deactivated by --deactivate-features MNG8000" ),
+
+    /**
+     * This is an feature toggle which will never being used nor does it exist.
+     * This is only to mark the end of feature toggles. Also used for unit tests.
+     * Furthermore by using this you can remove all other features but this
+     * type keep a single entry. 
+     * 
+     * Keep it at the last position in this enumeration.
+     */
+    UNKNOWN ("UNKNOWN", "The unknown feature.");
+
+    private String issue;
+
+    private String description;
+
+    private ActivatedFeatureToggles( String issue, String description )
+    {
+        this.issue = issue;
+        this.description = description;
+    }
+
+    /**
+     * @return The list of features without {@code #UNKNOWN}.
+     */
+    public static ActivatedFeatureToggles[] getActivatedFeatureToggles() {
+        List<ActivatedFeatureToggles> asList = Arrays.asList( ActivatedFeatureToggles.values());
+
+        ActivatedFeatureToggles[] result = new ActivatedFeatureToggles[asList.size() - 1];
+        
+        for ( int i = 0; i < asList.size() - 1; i++ )
+        {
+            if (asList.get( i ) != UNKNOWN) {
+                result[i] = asList.get( i );
+            }
+        }
+        return result;
+    }
+    
+    public String getDescription()
+    {
+        return this.description;
+    }
+
+    public String getIssue()
+    {
+        return this.issue;
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/c4e94a27/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java b/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
index 2f75fbe..a47dc8c 100644
--- a/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
+++ b/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
@@ -20,6 +20,7 @@ package org.apache.maven.feature;
  */
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
@@ -50,6 +51,8 @@ public class DefaultFeatureToggles
         if ( featuresToBeActivated == null )
         {
             this.activatedFeatureToggles = new ArrayList<>();
+            List<ActivatedFeatureToggles> asList = Arrays.asList( ActivatedFeatureToggles.getActivatedFeatureToggles());
+            this.activatedFeatureToggles.addAll( asList );
         }
         else
         {


[21/33] maven git commit: [MNG-6073] Addition of a core extension point to the model builder supporting model finalization.

Posted by kh...@apache.org.
[MNG-6073] Addition of a core extension point to the model builder supporting model finalization.

o Updated to remove the example component. Things like that really should go
  into the core extension.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/3628e966
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/3628e966
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/3628e966

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 3628e9665a6d1340da4e9b5bd6d1d05e6f9adfc2
Parents: fad97f2
Author: Christian Schulte <sc...@apache.org>
Authored: Sun Jul 31 17:31:46 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sun Jul 31 17:44:19 2016 +0200

----------------------------------------------------------------------
 .../DependencyManagementModelFinalizer.java     | 168 -------------------
 1 file changed, 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/3628e966/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java b/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
deleted file mode 100644
index c43e3dd..0000000
--- a/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.apache.maven.model.finalization;
-
-/*
- * 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.
- */
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.building.ModelBuildingRequest;
-import org.apache.maven.model.building.ModelProblemCollector;
-import org.apache.maven.model.management.DependencyManagementInjector;
-import org.codehaus.plexus.component.annotations.Requirement;
-
-/**
- * A {@code ModelFinalizer} adding classified dependency declarations to the dependency management for all unclassified
- * dependency declarations with classifiers taken from a collection of well-known classifiers.
- * <p>
- * This {@code ModelFinalizer} implementation is not wired by default. It will need to be setup manually. This can be
- * done by adding a {@code META-INF/plexus/components.xml} file containing the following to the Maven core classpath,
- * for example.
- * <pre>
- * &lt;component-set>
- *   &lt;components>
- *     &lt;component>
- *       &lt;role>org.apache.maven.model.finalization.ModelFinalizer&lt;/role>
- *       &lt;implementation>org.apache.maven.model.finalization.DependencyManagementModelFinalizer&lt;/implementation>
- *       &lt;role-hint>dependency-management&lt;/role-hint>
- *       &lt;requirements>
- *         &lt;requirement>
- *           &lt;role>org.apache.maven.model.management.DependencyManagementInjector</role>
- *           &lt;field-name>dependencyManagementInjector</field-name>
- *         &lt;/requirement>
- *       &lt;/requirements>
- *       &lt;configuration>
- *         &lt;dependencyManagementClassifiers>
- *           &lt;dependencyManagementClassifier>tests&lt;/dependencyManagementClassifier>
- *           &lt;dependencyManagementClassifier>javadoc&lt;/dependencyManagementClassifier>
- *           &lt;dependencyManagementClassifier>test-javadoc&lt;/dependencyManagementClassifier>
- *           &lt;dependencyManagementClassifier>shaded&lt;/dependencyManagementClassifier>
- *           &lt;dependencyManagementClassifier>site&lt;/dependencyManagementClassifier>
- *           &lt;dependencyManagementClassifier>sources&lt;/dependencyManagementClassifier>
- *           &lt;dependencyManagementClassifier>test-sources&lt;/dependencyManagementClassifier>
- *         &lt;/dependencyManagementClassifiers>
- *       &lt;/configuration>
- *     &lt;/component>
- *   &lt;/components>
- * &lt;/component-set>
- * </pre>
- * </p>
- *
- * @author Christian Schulte
- * @since 3.4
- */
-public final class DependencyManagementModelFinalizer
-    implements ModelFinalizer
-{
-
-    @Requirement
-    private DependencyManagementInjector dependencyManagementInjector;
-
-    private Collection<String> dependencyManagementClassifiers;
-
-    public DependencyManagementModelFinalizer setDependencyManagementInjector( DependencyManagementInjector value )
-    {
-        this.dependencyManagementInjector = value;
-        return this;
-    }
-
-    /**
-     * Gets the collection of well-known classifiers to use for adding classified dependency declarations.
-     *
-     * @return The collection of well-known classifiers to use.
-     */
-    public Collection<String> getDependencyManagementClassifiers()
-    {
-        if ( this.dependencyManagementClassifiers == null )
-        {
-            this.dependencyManagementClassifiers = new HashSet<>();
-        }
-
-        return this.dependencyManagementClassifiers;
-    }
-
-    /**
-     * Adds classified dependency declarations for all unclassified dependency declarations to the dependency management
-     * of the given {@code Model} with classifiers taken from set of well-known classifiers.
-     *
-     * @param model The {@code Model} to add classified dependency declarations to, must not be {@code null}.
-     * @param request The model building request that holds further settings, must not be {@code null}.
-     * @param problems The container used to collect problems that were encountered, must not be {@code null}.
-     */
-    @Override
-    public void finalizeModel( final Model model, final ModelBuildingRequest request,
-                               final ModelProblemCollector problems )
-    {
-        if ( model.getDependencyManagement() != null )
-        {
-            final Set<Dependency> classifiedDependencies = new HashSet<>();
-
-            for ( final Dependency managedDependency : model.getDependencyManagement().getDependencies() )
-            {
-                for ( final String classifier : this.getDependencyManagementClassifiers() )
-                {
-                    Dependency classifiedDependency =
-                        getDependency( model.getDependencyManagement(), managedDependency.getGroupId(),
-                                       managedDependency.getArtifactId(), managedDependency.getType(),
-                                       classifier );
-
-                    if ( classifiedDependency == null )
-                    {
-                        classifiedDependency = managedDependency.clone();
-                        classifiedDependencies.add( classifiedDependency );
-
-                        classifiedDependency.setClassifier( classifier );
-                    }
-                }
-            }
-
-            if ( !classifiedDependencies.isEmpty() )
-            {
-                model.getDependencyManagement().getDependencies().addAll( classifiedDependencies );
-                this.dependencyManagementInjector.injectManagement( model, request, problems );
-            }
-        }
-    }
-
-    private static Dependency getDependency( final DependencyManagement dependencyManagement,
-                                             final String groupId, final String artifactId, final String type,
-                                             final String classifier )
-    {
-        Dependency dependency = null;
-
-        for ( final Dependency candidate : dependencyManagement.getDependencies() )
-        {
-            if ( groupId.equals( candidate.getGroupId() )
-                     && artifactId.equals( candidate.getArtifactId() )
-                     && type.equals( candidate.getType() )
-                     && classifier.equals( candidate.getClassifier() ) )
-            {
-                dependency = candidate;
-                break;
-            }
-        }
-
-        return dependency;
-    }
-
-}


[15/33] maven git commit: [MNG-6073] Addition of a core extension point to the model builer supporting model finalization. [MNG-3825] Dependencies with classifier should not always require a version.

Posted by kh...@apache.org.
[MNG-6073] Addition of a core extension point to the model builer supporting model finalization.
[MNG-3825] Dependencies with classifier should not always require a version.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/17f68388
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/17f68388
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/17f68388

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 17f6838881b24df0eeb88f6b83a20065c51c48b5
Parents: 5307750
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Jul 30 20:10:16 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sat Jul 30 20:10:16 2016 +0200

----------------------------------------------------------------------
 .../model/building/DefaultModelBuilder.java     |  18 +++
 .../DependencyManagementModelFinalizer.java     | 159 +++++++++++++++++++
 .../model/finalization/ModelFinalizer.java      |  44 +++++
 maven-model-builder/src/site/apt/index.apt      |   2 +
 4 files changed, 223 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/17f68388/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 0224367..415808b 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -51,6 +51,7 @@ import org.apache.maven.model.Repository;
 import org.apache.maven.model.building.ModelProblem.Severity;
 import org.apache.maven.model.building.ModelProblem.Version;
 import org.apache.maven.model.composition.DependencyManagementImporter;
+import org.apache.maven.model.finalization.ModelFinalizer;
 import org.apache.maven.model.inheritance.InheritanceAssembler;
 import org.apache.maven.model.interpolation.ModelInterpolator;
 import org.apache.maven.model.io.ModelParseException;
@@ -139,6 +140,9 @@ public class DefaultModelBuilder
     @Requirement
     private ReportingConverter reportingConverter;
 
+    @Requirement( optional = true )
+    private List<ModelFinalizer> modelFinalizers;
+
     public DefaultModelBuilder setModelProcessor( ModelProcessor modelProcessor )
     {
         this.modelProcessor = modelProcessor;
@@ -241,6 +245,12 @@ public class DefaultModelBuilder
         return this;
     }
 
+    public DefaultModelBuilder setModelFinalizers( List<ModelFinalizer> value )
+    {
+        this.modelFinalizers = value;
+        return this;
+    }
+
     @Override
     public ModelBuildingResult build( ModelBuildingRequest request )
         throws ModelBuildingException
@@ -502,6 +512,14 @@ public class DefaultModelBuilder
             pluginConfigurationExpander.expandPluginConfiguration( resultModel, request, problems );
         }
 
+        if ( this.modelFinalizers != null )
+        {
+            for ( final ModelFinalizer modelFinalizer : this.modelFinalizers )
+            {
+                modelFinalizer.finalizeModel( resultModel, request, problems );
+            }
+        }
+
         // effective model validation
         modelValidator.validateEffectiveModel( resultModel, request, problems );
 

http://git-wip-us.apache.org/repos/asf/maven/blob/17f68388/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java b/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
new file mode 100644
index 0000000..c69a174
--- /dev/null
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
@@ -0,0 +1,159 @@
+package org.apache.maven.model.finalization;
+
+/*
+ * 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.
+ */
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.management.DependencyManagementInjector;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * A {@code ModelFinalizer} adding classified dependency declarations to the dependency management for all unclassified
+ * dependency declarations with classifiers taken from set of well-known classifiers.
+ * <p>
+ * This class requires the {@code Set} implementation of well-known classifiers to be provided by the runtime
+ * environment. By default, no such implementation exists. As a starting point, that {@code Set} implementation should
+ * at least contain the following classifiers corresponding to plugin defaults.
+ * <table>
+ * <tr>
+ * <th>Plugin</th>
+ * <th>Classifiers</th>
+ * </tr>
+ * <tr>
+ * <td>maven-jar-plugin</td>
+ * <td>tests</td>
+ * </tr>
+ * <tr>
+ * <td>maven-javadoc-plugin</td>
+ * <td>javadoc, test-javadoc</td>
+ * </tr>
+ * <tr>
+ * <td>maven-shade-plugin</td>
+ * <td>shaded</td>
+ * </tr>
+ * <tr>
+ * <td>maven-site-plugin</td>
+ * <td>site</td>
+ * </tr>
+ * <tr>
+ * <td>maven-source-plugin</td>
+ * <td>sources, test-sources</td>
+ * </tr>
+ * </table>
+ * </p>
+ *
+ * @author Christian Schulte
+ * @since 3.4
+ */
+@Component( role = ModelFinalizer.class, hint = "dependency-management" )
+public class DependencyManagementModelFinalizer
+    implements ModelFinalizer
+{
+
+    @Requirement( role = Set.class, hint = "dependency-management-classifiers", optional = true )
+    private Set<String> dependencyManagementClassifiers;
+
+    @Requirement
+    private DependencyManagementInjector dependencyManagementInjector;
+
+    public DependencyManagementModelFinalizer setDependencyManagementInjector( DependencyManagementInjector value )
+    {
+        this.dependencyManagementInjector = value;
+        return this;
+    }
+
+    public DependencyManagementModelFinalizer setDependencyManagementClassifiers( Set<String> value )
+    {
+        this.dependencyManagementClassifiers = value;
+        return this;
+    }
+
+    /**
+     * Adds classified dependency declarations for all unclassified dependency declarations to the dependency management
+     * of the given {@code Model} with classifiers taken from set of well-known classifiers.
+     *
+     * @param model The {@code Model} to add classified dependency declarations to, must not be {@code null}.
+     * @param request The model building request that holds further settings, must not be {@code null}.
+     * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+     */
+    @Override
+    public void finalizeModel( final Model model, final ModelBuildingRequest request,
+                               final ModelProblemCollector problems )
+    {
+        if ( this.dependencyManagementClassifiers != null && model.getDependencyManagement() != null )
+        {
+            final Set<Dependency> classifiedDependencies = new HashSet<>();
+
+            for ( final Dependency managedDependency : model.getDependencyManagement().getDependencies() )
+            {
+                for ( final String classifier : this.dependencyManagementClassifiers )
+                {
+                    Dependency classifiedDependency =
+                        getDependency( model.getDependencyManagement(), managedDependency.getGroupId(),
+                                       managedDependency.getArtifactId(), managedDependency.getType(),
+                                       managedDependency.getClassifier() );
+
+                    if ( classifiedDependency == null )
+                    {
+                        classifiedDependency = managedDependency.clone();
+                        classifiedDependencies.add( classifiedDependency );
+
+                        classifiedDependency.setClassifier( classifier );
+                    }
+                }
+            }
+
+            if ( !classifiedDependencies.isEmpty() )
+            {
+                model.getDependencyManagement().getDependencies().addAll( classifiedDependencies );
+                this.dependencyManagementInjector.injectManagement( model, request, problems );
+            }
+        }
+    }
+
+    private static Dependency getDependency( final DependencyManagement dependencyManagement,
+                                             final String groupId, final String artifactId, final String type,
+                                             final String classifier )
+    {
+        Dependency dependency = null;
+
+        for ( final Dependency candidate : dependencyManagement.getDependencies() )
+        {
+            if ( groupId.equals( candidate.getGroupId() )
+                     && artifactId.equals( candidate.getArtifactId() )
+                     && type.equals( candidate.getType() )
+                     && classifier.equals( candidate.getClassifier() ) )
+            {
+                dependency = candidate;
+                break;
+            }
+        }
+
+        return dependency;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/17f68388/maven-model-builder/src/main/java/org/apache/maven/model/finalization/ModelFinalizer.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/finalization/ModelFinalizer.java b/maven-model-builder/src/main/java/org/apache/maven/model/finalization/ModelFinalizer.java
new file mode 100644
index 0000000..5f3da0f
--- /dev/null
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/finalization/ModelFinalizer.java
@@ -0,0 +1,44 @@
+package org.apache.maven.model.finalization;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Interface to model finalization.
+ *
+ * @author Christian Schulte
+ * @since 3.4
+ */
+public interface ModelFinalizer
+{
+
+    /**
+     * Finalizes a model.
+     *
+     * @param model The model to finalize, must not be {@code null}.
+     * @param request The model building request that holds further settings, must not be {@code null}.
+     * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+     */
+    void finalizeModel( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/17f68388/maven-model-builder/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt
index 0ff6f81..f2bed91 100644
--- a/maven-model-builder/src/site/apt/index.apt
+++ b/maven-model-builder/src/site/apt/index.apt
@@ -108,6 +108,8 @@ Maven Model Builder
    with its <<<DefaultPluginConfigurationExpander>>> implementation
    ({{{./xref/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.html}source}})
 
+   ** <(optional)> model finalization: <<<ModelFinalizer>>> ({{{./apidocs/org/apache/maven/model/finalization/ModelFinalizer.html}javadoc}})
+
    ** effective model validation: <<<ModelValidator>>> ({{{./apidocs/org/apache/maven/model/validation/ModelValidator.html}javadoc}}),
    with its <<<DefaultModelValidator>>> implementation
    ({{{./xref/org/apache/maven/model/validation/DefaultModelValidator.html}source}})


[28/33] maven git commit: Revert "[MNG-6076] Add the options from maven.config at the beginning to make it"

Posted by kh...@apache.org.
Revert "[MNG-6076] Add the options from maven.config at the beginning to make it"

This reverts commit b0be4e3a20e209b696c8c0d0a004ab15a0b563d0.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/4ba57795
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/4ba57795
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/4ba57795

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 4ba57795988fb813c80a8216ca8ec22aa00ae07d
Parents: b0be4e3
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Sun Aug 7 12:23:59 2016 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Sun Aug 7 12:23:59 2016 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/maven/cli/MavenCli.java   | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/4ba57795/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index f203683..6b482aa 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -35,14 +35,12 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
-
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.UnrecognizedOptionException;
@@ -110,6 +108,9 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
 import org.codehaus.plexus.logging.LoggerManager;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import com.google.common.base.Charsets;
+import com.google.common.io.Files;
+import com.google.inject.AbstractModule;
 import org.eclipse.aether.transfer.TransferListener;
 import org.slf4j.ILoggerFactory;
 import org.slf4j.Logger;
@@ -120,10 +121,6 @@ import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
 import org.sonatype.plexus.components.sec.dispatcher.SecUtil;
 import org.sonatype.plexus.components.sec.dispatcher.model.SettingsSecurity;
 
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
-import com.google.inject.AbstractModule;
-
 // TODO: push all common bits back to plexus cli and prepare for transition to Guice. We don't need 50 ways to make CLIs
 
 /**
@@ -396,7 +393,7 @@ public class MavenCli
 
         CLIManager cliManager = new CLIManager();
 
-        List<String> args = new LinkedList<>();
+        List<String> args = new ArrayList<>();
 
         try
         {
@@ -429,7 +426,7 @@ public class MavenCli
 
         try
         {
-            args.addAll( Arrays.asList( cliRequest.args ) );
+            args.addAll( 0, Arrays.asList( cliRequest.args ) );
             cliRequest.commandLine = cliManager.parse( args.toArray( new String[args.size()] ) );
         }
         catch ( ParseException e )


[20/33] maven git commit: [MNG-6073] Addition of a core extension point to the model builder supporting model finalization. [MNG-3825] Dependencies with classifier should not always require a version.

Posted by kh...@apache.org.
[MNG-6073] Addition of a core extension point to the model builder supporting model finalization.
[MNG-3825] Dependencies with classifier should not always require a version.

o Updated to stop wiring the component and to document how to make use of it.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/fad97f21
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/fad97f21
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/fad97f21

Branch: refs/heads/MNG-6056-feature-toggle
Commit: fad97f21e1f53210c6b8b9e7a16683b008aae2b5
Parents: 0246aed
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Jul 30 21:35:53 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sat Jul 30 22:31:31 2016 +0200

----------------------------------------------------------------------
 .../DependencyManagementModelFinalizer.java     | 93 +++++++++++---------
 1 file changed, 51 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/fad97f21/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java b/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
index c69a174..c43e3dd 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/finalization/DependencyManagementModelFinalizer.java
@@ -19,6 +19,7 @@ package org.apache.maven.model.finalization;
  * under the License.
  */
 
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -28,68 +29,76 @@ import org.apache.maven.model.Model;
 import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.model.building.ModelProblemCollector;
 import org.apache.maven.model.management.DependencyManagementInjector;
-import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 
 /**
  * A {@code ModelFinalizer} adding classified dependency declarations to the dependency management for all unclassified
- * dependency declarations with classifiers taken from set of well-known classifiers.
+ * dependency declarations with classifiers taken from a collection of well-known classifiers.
  * <p>
- * This class requires the {@code Set} implementation of well-known classifiers to be provided by the runtime
- * environment. By default, no such implementation exists. As a starting point, that {@code Set} implementation should
- * at least contain the following classifiers corresponding to plugin defaults.
- * <table>
- * <tr>
- * <th>Plugin</th>
- * <th>Classifiers</th>
- * </tr>
- * <tr>
- * <td>maven-jar-plugin</td>
- * <td>tests</td>
- * </tr>
- * <tr>
- * <td>maven-javadoc-plugin</td>
- * <td>javadoc, test-javadoc</td>
- * </tr>
- * <tr>
- * <td>maven-shade-plugin</td>
- * <td>shaded</td>
- * </tr>
- * <tr>
- * <td>maven-site-plugin</td>
- * <td>site</td>
- * </tr>
- * <tr>
- * <td>maven-source-plugin</td>
- * <td>sources, test-sources</td>
- * </tr>
- * </table>
+ * This {@code ModelFinalizer} implementation is not wired by default. It will need to be setup manually. This can be
+ * done by adding a {@code META-INF/plexus/components.xml} file containing the following to the Maven core classpath,
+ * for example.
+ * <pre>
+ * &lt;component-set>
+ *   &lt;components>
+ *     &lt;component>
+ *       &lt;role>org.apache.maven.model.finalization.ModelFinalizer&lt;/role>
+ *       &lt;implementation>org.apache.maven.model.finalization.DependencyManagementModelFinalizer&lt;/implementation>
+ *       &lt;role-hint>dependency-management&lt;/role-hint>
+ *       &lt;requirements>
+ *         &lt;requirement>
+ *           &lt;role>org.apache.maven.model.management.DependencyManagementInjector</role>
+ *           &lt;field-name>dependencyManagementInjector</field-name>
+ *         &lt;/requirement>
+ *       &lt;/requirements>
+ *       &lt;configuration>
+ *         &lt;dependencyManagementClassifiers>
+ *           &lt;dependencyManagementClassifier>tests&lt;/dependencyManagementClassifier>
+ *           &lt;dependencyManagementClassifier>javadoc&lt;/dependencyManagementClassifier>
+ *           &lt;dependencyManagementClassifier>test-javadoc&lt;/dependencyManagementClassifier>
+ *           &lt;dependencyManagementClassifier>shaded&lt;/dependencyManagementClassifier>
+ *           &lt;dependencyManagementClassifier>site&lt;/dependencyManagementClassifier>
+ *           &lt;dependencyManagementClassifier>sources&lt;/dependencyManagementClassifier>
+ *           &lt;dependencyManagementClassifier>test-sources&lt;/dependencyManagementClassifier>
+ *         &lt;/dependencyManagementClassifiers>
+ *       &lt;/configuration>
+ *     &lt;/component>
+ *   &lt;/components>
+ * &lt;/component-set>
+ * </pre>
  * </p>
  *
  * @author Christian Schulte
  * @since 3.4
  */
-@Component( role = ModelFinalizer.class, hint = "dependency-management" )
-public class DependencyManagementModelFinalizer
+public final class DependencyManagementModelFinalizer
     implements ModelFinalizer
 {
 
-    @Requirement( role = Set.class, hint = "dependency-management-classifiers", optional = true )
-    private Set<String> dependencyManagementClassifiers;
-
     @Requirement
     private DependencyManagementInjector dependencyManagementInjector;
 
+    private Collection<String> dependencyManagementClassifiers;
+
     public DependencyManagementModelFinalizer setDependencyManagementInjector( DependencyManagementInjector value )
     {
         this.dependencyManagementInjector = value;
         return this;
     }
 
-    public DependencyManagementModelFinalizer setDependencyManagementClassifiers( Set<String> value )
+    /**
+     * Gets the collection of well-known classifiers to use for adding classified dependency declarations.
+     *
+     * @return The collection of well-known classifiers to use.
+     */
+    public Collection<String> getDependencyManagementClassifiers()
     {
-        this.dependencyManagementClassifiers = value;
-        return this;
+        if ( this.dependencyManagementClassifiers == null )
+        {
+            this.dependencyManagementClassifiers = new HashSet<>();
+        }
+
+        return this.dependencyManagementClassifiers;
     }
 
     /**
@@ -104,18 +113,18 @@ public class DependencyManagementModelFinalizer
     public void finalizeModel( final Model model, final ModelBuildingRequest request,
                                final ModelProblemCollector problems )
     {
-        if ( this.dependencyManagementClassifiers != null && model.getDependencyManagement() != null )
+        if ( model.getDependencyManagement() != null )
         {
             final Set<Dependency> classifiedDependencies = new HashSet<>();
 
             for ( final Dependency managedDependency : model.getDependencyManagement().getDependencies() )
             {
-                for ( final String classifier : this.dependencyManagementClassifiers )
+                for ( final String classifier : this.getDependencyManagementClassifiers() )
                 {
                     Dependency classifiedDependency =
                         getDependency( model.getDependencyManagement(), managedDependency.getGroupId(),
                                        managedDependency.getArtifactId(), managedDependency.getType(),
-                                       managedDependency.getClassifier() );
+                                       classifier );
 
                     if ( classifiedDependency == null )
                     {


[25/33] maven git commit: [MNG-6075] Increase the model validation level to the next minor level version.

Posted by kh...@apache.org.
[MNG-6075] Increase the model validation level to the next minor level version.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/615390d7
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/615390d7
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/615390d7

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 615390d7cfddb328704cf64f0a942a0f40d5c9df
Parents: 0fbad04
Author: Christian Schulte <sc...@apache.org>
Authored: Mon Aug 1 09:46:57 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Mon Aug 1 09:52:44 2016 +0200

----------------------------------------------------------------------
 .../project/AbstractMavenProjectTestCase.java   |  2 ++
 .../validation/DefaultModelValidatorTest.java   | 38 ++++++++++----------
 2 files changed, 21 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/615390d7/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
----------------------------------------------------------------------
diff --git a/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java b/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
index 7db65d8..68f0219 100644
--- a/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
+++ b/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
@@ -28,6 +28,7 @@ import org.apache.maven.artifact.repository.MavenArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.model.building.ModelBuildingException;
+import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.model.building.ModelProblem;
 import org.apache.maven.repository.RepositorySystem;
 import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
@@ -196,6 +197,7 @@ public abstract class AbstractMavenProjectTestCase
     {
         ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
         configuration.setLocalRepository( getLocalRepository() );
+        configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
         initRepoSession( configuration );
         return configuration;
     }

http://git-wip-us.apache.org/repos/asf/maven/blob/615390d7/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
index dde532d..3f44634 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
@@ -440,12 +440,12 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validateRaw( "duplicate-plugin.xml" );
 
-        assertViolations( result, 0, 0, 4 );
+        assertViolations( result, 0, 4, 0 );
 
-        assertTrue( result.getWarnings().get( 0 ).contains( "duplicate declaration of plugin test:duplicate" ) );
-        assertTrue( result.getWarnings().get( 1 ).contains( "duplicate declaration of plugin test:managed-duplicate" ) );
-        assertTrue( result.getWarnings().get( 2 ).contains( "duplicate declaration of plugin profile:duplicate" ) );
-        assertTrue( result.getWarnings().get( 3 ).contains( "duplicate declaration of plugin profile:managed-duplicate" ) );
+        assertTrue( result.getErrors().get( 0 ).contains( "duplicate declaration of plugin test:duplicate" ) );
+        assertTrue( result.getErrors().get( 1 ).contains( "duplicate declaration of plugin test:managed-duplicate" ) );
+        assertTrue( result.getErrors().get( 2 ).contains( "duplicate declaration of plugin profile:duplicate" ) );
+        assertTrue( result.getErrors().get( 3 ).contains( "duplicate declaration of plugin profile:managed-duplicate" ) );
     }
 
     public void testDuplicatePluginExecution()
@@ -466,12 +466,12 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validate( "reserved-repository-id.xml" );
 
-        assertViolations( result, 0, 0, 4 );
+        assertViolations( result, 0, 4, 0 );
 
-        assertContains( result.getWarnings().get( 0 ), "'repositories.repository.id'" + " must not be 'local'" );
-        assertContains( result.getWarnings().get( 1 ), "'pluginRepositories.pluginRepository.id' must not be 'local'" );
-        assertContains( result.getWarnings().get( 2 ), "'distributionManagement.repository.id' must not be 'local'" );
-        assertContains( result.getWarnings().get( 3 ),
+        assertContains( result.getErrors().get( 0 ), "'repositories.repository.id'" + " must not be 'local'" );
+        assertContains( result.getErrors().get( 1 ), "'pluginRepositories.pluginRepository.id' must not be 'local'" );
+        assertContains( result.getErrors().get( 2 ), "'distributionManagement.repository.id' must not be 'local'" );
+        assertContains( result.getErrors().get( 3 ),
                         "'distributionManagement.snapshotRepository.id' must not be 'local'" );
     }
 
@@ -520,9 +520,9 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validate( "bad-version.xml" );
 
-        assertViolations( result, 0, 0, 1 );
+        assertViolations( result, 0, 1, 0 );
 
-        assertContains( result.getWarnings().get( 0 ), "'version' must not contain any of these characters" );
+        assertContains( result.getErrors().get( 0 ), "'version' must not contain any of these characters" );
     }
 
     public void testBadSnapshotVersion()
@@ -530,9 +530,9 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validate( "bad-snapshot-version.xml" );
 
-        assertViolations( result, 0, 0, 1 );
+        assertViolations( result, 0, 1, 0 );
 
-        assertContains( result.getWarnings().get( 0 ), "'version' uses an unsupported snapshot version format" );
+        assertContains( result.getErrors().get( 0 ), "'version' uses an unsupported snapshot version format" );
     }
 
     public void testBadRepositoryId()
@@ -540,15 +540,15 @@ public class DefaultModelValidatorTest
     {
         SimpleProblemCollector result = validate( "bad-repository-id.xml" );
 
-        assertViolations( result, 0, 0, 4 );
+        assertViolations( result, 0, 4, 0 );
 
-        assertContains( result.getWarnings().get( 0 ),
+        assertContains( result.getErrors().get( 0 ),
                         "'repositories.repository.id' must not contain any of these characters" );
-        assertContains( result.getWarnings().get( 1 ),
+        assertContains( result.getErrors().get( 1 ),
                         "'pluginRepositories.pluginRepository.id' must not contain any of these characters" );
-        assertContains( result.getWarnings().get( 2 ),
+        assertContains( result.getErrors().get( 2 ),
                         "'distributionManagement.repository.id' must not contain any of these characters" );
-        assertContains( result.getWarnings().get( 3 ),
+        assertContains( result.getErrors().get( 3 ),
                         "'distributionManagement.snapshotRepository.id' must not contain any of these characters" );
     }
 


[24/33] maven git commit: [MNG-6075] Increase the model validation level to the next minor level version.

Posted by kh...@apache.org.
[MNG-6075] Increase the model validation level to the next minor level version.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/0fbad04c
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/0fbad04c
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/0fbad04c

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 0fbad04c5ff63c87b6d80873cb8b45b6c9b79781
Parents: 744b98e
Author: Christian Schulte <sc...@apache.org>
Authored: Mon Aug 1 09:36:06 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Mon Aug 1 09:36:06 2016 +0200

----------------------------------------------------------------------
 .../model/building/DefaultModelBuilder.java     | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/0fbad04c/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index e5e5dc5..2d50ed1 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -30,6 +30,7 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 
 import org.apache.commons.lang3.Validate;
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
@@ -387,6 +388,7 @@ public class DefaultModelBuilder
         }
 
         problems.setSource( inputModel );
+        checkModelVersions( lineage, request, problems );
         checkPluginVersions( lineage, request, problems );
 
         // [MNG-4052] import scope dependencies prefer to download pom rather than find it in the current project
@@ -769,6 +771,33 @@ public class DefaultModelBuilder
         }
     }
 
+    private void checkModelVersions( final List<ModelData> lineage, final ModelBuildingRequest request,
+                                     final ModelProblemCollector problems )
+    {
+        if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 )
+        {
+            final Set<String> modelVersions = new HashSet<>( lineage.size() );
+
+            for ( int i = lineage.size() - 1; i >= 0; i-- )
+            {
+                final Model model = lineage.get( i ).getModel();
+
+                if ( model.getModelVersion() != null )
+                {
+                    if ( !modelVersions.isEmpty() && modelVersions.add( model.getModelVersion() ) )
+                    {
+                        problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.V31 )
+                            .setMessage( String.format(
+                                    "Cannot inherit from parent '%s' with different model version '%s'."
+                                        + " Expected model version '%s'.",
+                                    model.getId(), model.getModelVersion(), modelVersions.iterator().next() ) ) );
+
+                    }
+                }
+            }
+        }
+    }
+
     private void processImports( final List<Model> lineage, final ModelBuildingRequest request,
                                  final DefaultModelProblemCollector problems )
     {


[27/33] maven git commit: [MNG-6076] Add the options from maven.config at the beginning to make it possible to overwrite via command line o Currently this only helps for properties which are defined via -D.. in maven.config file. For other options li

Posted by kh...@apache.org.
[MNG-6076] Add the options from maven.config at the beginning to make it
possible to overwrite via command line
 o Currently this only helps for properties which are defined via
   -D.. in maven.config file. For other options like -T .. etc.
   this will not work cause the command line analyzer only looks
   for the first occurrence of options.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/b0be4e3a
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/b0be4e3a
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/b0be4e3a

Branch: refs/heads/MNG-6056-feature-toggle
Commit: b0be4e3a20e209b696c8c0d0a004ab15a0b563d0
Parents: a5e87a4
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Sat Aug 6 18:48:58 2016 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Sat Aug 6 20:00:23 2016 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/maven/cli/MavenCli.java   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/b0be4e3a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 6b482aa..f203683 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -35,12 +35,14 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
+
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.UnrecognizedOptionException;
@@ -108,9 +110,6 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
 import org.codehaus.plexus.logging.LoggerManager;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
-import com.google.inject.AbstractModule;
 import org.eclipse.aether.transfer.TransferListener;
 import org.slf4j.ILoggerFactory;
 import org.slf4j.Logger;
@@ -121,6 +120,10 @@ import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
 import org.sonatype.plexus.components.sec.dispatcher.SecUtil;
 import org.sonatype.plexus.components.sec.dispatcher.model.SettingsSecurity;
 
+import com.google.common.base.Charsets;
+import com.google.common.io.Files;
+import com.google.inject.AbstractModule;
+
 // TODO: push all common bits back to plexus cli and prepare for transition to Guice. We don't need 50 ways to make CLIs
 
 /**
@@ -393,7 +396,7 @@ public class MavenCli
 
         CLIManager cliManager = new CLIManager();
 
-        List<String> args = new ArrayList<>();
+        List<String> args = new LinkedList<>();
 
         try
         {
@@ -426,7 +429,7 @@ public class MavenCli
 
         try
         {
-            args.addAll( 0, Arrays.asList( cliRequest.args ) );
+            args.addAll( Arrays.asList( cliRequest.args ) );
             cliRequest.commandLine = cliManager.parse( args.toArray( new String[args.size()] ) );
         }
         catch ( ParseException e )


[07/33] maven git commit: updated code to match API change after Michael's feedback

Posted by kh...@apache.org.
updated code to match API change after Michael's feedback

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/7fa6ce71
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/7fa6ce71
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/7fa6ce71

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 7fa6ce7175b285b0c4eea8acf05435bb5001acfd
Parents: 14182b8
Author: Herv� Boutemy <hb...@apache.org>
Authored: Sun Jul 17 19:08:21 2016 +0200
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Sun Jul 17 19:08:21 2016 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/maven/cli/MavenCli.java         | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/7fa6ce71/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 79f5819..b0cd1cd 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -476,7 +476,7 @@ public class MavenCli
 
         if ( cliRequest.commandLine.hasOption( CLIManager.BATCH_MODE ) )
         {
-            MessageUtils.setColor( false );
+            MessageUtils.setColorEnabled( false );
         }
 
         if ( cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) )
@@ -484,7 +484,7 @@ public class MavenCli
             File logFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.LOG_FILE ) );
             logFile = resolveFile( logFile, cliRequest.workingDirectory );
 
-            MessageUtils.setColor( false );
+            MessageUtils.setColorEnabled( false );
 
             // redirect stdout and stderr to file
             try
@@ -533,8 +533,8 @@ public class MavenCli
 
         if ( slf4jLogger.isDebugEnabled() )
         {
-            slf4jLogger.debug( "Message scheme: " + ( MessageUtils.isColor() ? "color" : "plain" ) );
-            if ( MessageUtils.isColor() )
+            slf4jLogger.debug( "Message scheme: " + ( MessageUtils.isColorEnabled() ? "color" : "plain" ) );
+            if ( MessageUtils.isColorEnabled() )
             {
                 MessageBuffer buff = MessageUtils.buffer();
                 buff.a( "Message styles: " );


[29/33] maven git commit: [MNG-6078] Can't overwrite properties which have been defined in .mvn/maven.config o Reversed the order of properties only to get the properties from command line at the end of the properties list which results in correct

Posted by kh...@apache.org.
[MNG-6078] Can't overwrite properties which have been defined in
.mvn/maven.config
 o Reversed the order of properties only to get the properties from
   command line at the end of the properties list which results
   in correct behaviour to be able to overwrite properties from
   command line for properties which have been defined in
   .mvn/maven.config file.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/9f2452ad
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/9f2452ad
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/9f2452ad

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 9f2452adb6333d5f38f4cf3d652261726fa1f9e2
Parents: 4ba5779
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Sun Aug 7 12:21:01 2016 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Sun Aug 7 13:07:28 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/maven/cli/MavenCli.java     | 12 ++++-
 .../java/org/apache/maven/cli/MavenCliTest.java | 53 ++++++++++++++++++--
 .../mavenConfigProperties/.mvn/maven.config     |  3 ++
 3 files changed, 62 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/9f2452ad/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 6b482aa..822f696 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -44,6 +44,7 @@ import java.util.StringTokenizer;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.UnrecognizedOptionException;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.maven.BuildAbort;
 import org.apache.maven.InternalErrorException;
 import org.apache.maven.Maven;
@@ -552,7 +553,9 @@ public class MavenCli
         }
     }
 
-    private void properties( CliRequest cliRequest )
+    //Needed to make this method package visible to make writing a unit test possible
+    //Maybe it's better to move some of those methods to separate class (SoC).
+    void properties( CliRequest cliRequest )
     {
         populateProperties( cliRequest.commandLine, cliRequest.systemProperties, cliRequest.userProperties );
     }
@@ -1668,9 +1671,14 @@ public class MavenCli
         if ( commandLine.hasOption( CLIManager.SET_SYSTEM_PROPERTY ) )
         {
             String[] defStrs = commandLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY );
-
+            
             if ( defStrs != null )
             {
+                //The following is needed to get precedence
+                //of properties which are defined on command line
+                //over properties defined in the .mvn/maven.config. 
+                ArrayUtils.reverse( defStrs );
+                
                 for ( String defStr : defStrs )
                 {
                     setCliProperty( defStr, userProperties );

http://git-wip-us.apache.org/repos/asf/maven/blob/9f2452ad/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
index c8d75b1..d926624 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
@@ -21,10 +21,10 @@ package org.apache.maven.cli;
 
 import java.io.File;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.cli.ParseException;
 
+import junit.framework.TestCase;
+
 public class MavenCliTest
     extends TestCase
 {
@@ -81,8 +81,8 @@ public class MavenCliTest
         // read .mvn/maven.config
         cli.initialize( request );
         cli.cli( request );
-        assertEquals( "multithreaded", request.commandLine.getOptionValue( "builder" ) );
-        assertEquals( "8", request.commandLine.getOptionValue( "threads" ) );
+        assertEquals( "multithreaded", request.commandLine.getOptionValue( CLIManager.BUILDER ) );
+        assertEquals( "8", request.commandLine.getOptionValue( CLIManager.THREADS ) );
 
         // override from command line
         request = new CliRequest( new String[] { "--builder", "foobar" }, null );
@@ -107,4 +107,49 @@ public class MavenCliTest
 
         }
     }
+    
+    /**
+     * Read .mvn/maven.config with the following definitions:
+     * <pre>
+     *   -T 3
+     *   -Drevision=1.3.0
+     * </pre>
+     * and check if the {@code -T 3} option can be overwritten via command line
+     * argument.
+     * @throws Exception in case of failure.
+     */
+    public void testMVNConfigurationThreadCanBeOverwrittenViaCommandLine() throws Exception {
+        System.setProperty( MavenCli.MULTIMODULE_PROJECT_DIRECTORY, new File( "src/test/projects/mavenConfigProperties" ).getCanonicalPath() );
+        CliRequest request = new CliRequest( new String[]{ "-T", "5" }, null );
+
+        cli.initialize( request );
+        // read .mvn/maven.config
+        cli.cli( request );
+        
+        assertEquals( "5", request.commandLine.getOptionValue( CLIManager.THREADS ) );
+    }
+    
+    /**
+     * Read .mvn/maven.config with the following definitions:
+     * <pre>
+     *   -T 3
+     *   -Drevision=1.3.0
+     * </pre>
+     * and check if the {@code -Drevision-1.3.0} option can be overwritten via command line
+     * argument.
+     * @throws Exception
+     */
+    public void testMVNConfigurationDefinedPropertiesCanBeOverwrittenViaCommandLine() throws Exception {
+        System.setProperty( MavenCli.MULTIMODULE_PROJECT_DIRECTORY, new File( "src/test/projects/mavenConfigProperties" ).getCanonicalPath() );
+        CliRequest request = new CliRequest( new String[]{ "-Drevision=8.1.0"}, null );
+
+        cli.initialize( request );
+        // read .mvn/maven.config
+        cli.cli( request );
+        cli.properties( request );
+        
+        String revision = System.getProperty( "revision" );
+        assertEquals( "8.1.0", revision );
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven/blob/9f2452ad/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config
----------------------------------------------------------------------
diff --git a/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config b/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config
new file mode 100644
index 0000000..c73de53
--- /dev/null
+++ b/maven-embedder/src/test/projects/mavenConfigProperties/.mvn/maven.config
@@ -0,0 +1,3 @@
+-T 3
+-Drevision=1.3.0
+


[18/33] maven git commit: [MNG-6074] Maven should print a warning if no model version has been set in a POM file.

Posted by kh...@apache.org.
[MNG-6074] Maven should print a warning if no model version has been set in a POM file.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/45a04204
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/45a04204
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/45a04204

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 45a04204f720c9ed9c70c825fdb7834adb83852c
Parents: 2e255c8
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Jul 30 21:02:03 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sat Jul 30 21:02:03 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/model/validation/DefaultModelValidator.java    | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/45a04204/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
index 1d3a0f6..efe8895 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -101,6 +101,7 @@ public class DefaultModelValidator
         {
             Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
 
+            validateStringNotEmpty( "modelVersion", problems, Severity.WARNING, Version.V20, m.getModelVersion(), m );
             validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, m.getModelVersion(), null, m,
                           "4.0.0" );
 


[04/33] maven git commit: [MNG-3507] add color message debug info

Posted by kh...@apache.org.
[MNG-3507] add color message debug info

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/5dab4940
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/5dab4940
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/5dab4940

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 5dab4940c9a7d3b362bd2a8b078b183e4eb521bb
Parents: 1b5b4f0
Author: Herv� Boutemy <hb...@apache.org>
Authored: Sun Jul 10 11:38:50 2016 +0200
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Sun Jul 10 11:38:50 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/maven/cli/MavenCli.java     | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/5dab4940/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 3e1194b..eeb22c6 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -91,6 +91,7 @@ import org.apache.maven.model.profile.ProfileSelector;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.properties.internal.EnvironmentUtils;
 import org.apache.maven.properties.internal.SystemProperties;
+import org.apache.maven.shared.utils.logging.MessageBuffer;
 import org.apache.maven.shared.utils.logging.MessageUtils;
 import org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest;
 import org.apache.maven.toolchain.building.ToolchainsBuilder;
@@ -529,6 +530,26 @@ public class MavenCli
         {
             slf4jLogger.info( "Enabling strict checksum verification on all artifact downloads." );
         }
+
+        if ( slf4jLogger.isDebugEnabled() )
+        {
+            slf4jLogger.debug( "message scheme: " + ( MessageUtils.isColor() ? "color" : "plain" ) );
+            if ( MessageUtils.isColor() )
+            {
+                MessageBuffer buff = MessageUtils.buffer();
+                buff.a( "message styles: " );
+                buff.debug().a( "debug" ).reset().a( ' ' );
+                buff.info().a( "info" ).reset().a( ' ' );
+                buff.warning().a( "warning" ).reset().a( ' ' );
+                buff.error().a( "error" ).reset().a( ' ' );
+                buff.success( "success" ).a( ' ' );
+                buff.failure( "failure" ).a( ' ' );
+                buff.strong( "strong" ).a( ' ' );
+                buff.mojo( "mojo" ).a( ' ' );
+                buff.project( "project" );
+                slf4jLogger.debug( buff.toString() );
+            }
+        }
     }
 
     private void properties( CliRequest cliRequest )


[03/33] maven git commit: [MNG-5951] fixed description of the 3 attributes and the effect on the 5 urls fields (inconsistencies found when working on MNG-6059)

Posted by kh...@apache.org.
[MNG-5951] fixed description of the 3 attributes and the effect on
the 5 urls fields (inconsistencies found when working on MNG-6059)

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/1b5b4f03
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/1b5b4f03
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/1b5b4f03

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 1b5b4f032b46fe4f2e1afcf0e3613d3cb362d996
Parents: 2270852
Author: Herv� Boutemy <hb...@apache.org>
Authored: Sat Jul 9 20:44:35 2016 +0200
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Sat Jul 9 20:44:35 2016 +0200

----------------------------------------------------------------------
 maven-model/src/main/mdo/maven.mdo | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/1b5b4f03/maven-model/src/main/mdo/maven.mdo
----------------------------------------------------------------------
diff --git a/maven-model/src/main/mdo/maven.mdo b/maven-model/src/main/mdo/maven.mdo
index a737fe9..313fd19 100644
--- a/maven-model/src/main/mdo/maven.mdo
+++ b/maven-model/src/main/mdo/maven.mdo
@@ -246,7 +246,7 @@
             <![CDATA[
             The URL to the project's homepage.
             <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
-            <code>child.urls.inherit.append.path="false"</code>
+            project's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>
           <type>String</type>
@@ -256,7 +256,7 @@
           <version>4.0.0+</version>
           <description>
             <![CDATA[
-            When childs inherit from urls, append path or not?. Note: While the type
+            When childs inherit from project's url, append path or not? Note: While the type
             of this field is <code>String</code> for technical reasons, the semantic type is actually
             <code>Boolean</code>
             <br /><b>Default value is</b>: <code>true</code>
@@ -2174,7 +2174,8 @@
             <a href="https://maven.apache.org/scm/scm-url-format.html">URL format</a>
             and <a href="https://maven.apache.org/scm/scms-overview.html">list of supported SCMs</a>.
             This connection is read-only.
-            <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId
+            <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
+            scm's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>
           <type>String</type>
@@ -2186,7 +2187,8 @@
             <![CDATA[
             Just like <code>connection</code>, but for developers, i.e. this scm connection
             will not be read only.
-            <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId
+            <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
+            scm's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>
           <type>String</type>
@@ -2205,7 +2207,7 @@
             <![CDATA[
             The URL to the project's browsable SCM repository, such as ViewVC or Fisheye.
             <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
-            <code>child.urls.inherit.append.path="false"</code>
+            scm's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>
           <type>String</type>
@@ -2215,7 +2217,7 @@
           <version>4.0.0+</version>
           <description>
             <![CDATA[
-            When childs inherit from urls, append path or not?. Note: While the type
+            When childs inherit from scm urls, append path or not? Note: While the type
             of this field is <code>String</code> for technical reasons, the semantic type is actually
             <code>Boolean</code>
             <br /><b>Default value is</b>: <code>true</code>
@@ -2672,7 +2674,7 @@
             <![CDATA[
             The url of the location where website is deployed, in the form <code>protocol://hostname/path</code>.
             <br /><b>Default value is</b>: parent value [+ path adjustment] + artifactId, or just parent value if 
-            <code>child.urls.inherit.append.path="false"</code>
+            site's <code>child.inherit.append.path="false"</code>
             ]]>
           </description>
           <type>String</type>
@@ -2682,7 +2684,7 @@
           <version>4.0.0+</version>
           <description>
             <![CDATA[
-            When childs inherit from urls, append path or not?. Note: While the type
+            When childs inherit from distribution management site url, append path or not? Note: While the type
             of this field is <code>String</code> for technical reasons, the semantic type is actually
             <code>Boolean</code>
             <br /><b>Default value is</b>: <code>true</code>


[17/33] maven git commit: [MNG-6073] Addition of a core extension point to the model builder supporting model finalization. [MNG-3825] Dependencies with classifier should not always require a version.

Posted by kh...@apache.org.
[MNG-6073] Addition of a core extension point to the model builder supporting model finalization.
[MNG-3825] Dependencies with classifier should not always require a version.

o Updated to move a '@since' tag to the correct method.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/2e255c8e
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/2e255c8e
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/2e255c8e

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 2e255c8e474ead2a18fd0dddd678a4fac84968a9
Parents: 7181e5b
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Jul 30 20:22:26 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sat Jul 30 20:22:26 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/model/building/DefaultModelBuilder.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/2e255c8e/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 2fdc4ee..e5e5dc5 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -239,15 +239,15 @@ public class DefaultModelBuilder
         return this;
     }
 
-    /**
-     * @since 3.4
-     */
     public DefaultModelBuilder setReportingConverter( ReportingConverter reportingConverter )
     {
         this.reportingConverter = reportingConverter;
         return this;
     }
 
+    /**
+     * @since 3.4
+     */
     public DefaultModelBuilder setModelFinalizers( List<ModelFinalizer> value )
     {
         this.modelFinalizers = value;


[30/33] maven git commit: [MNG-6056] Implement Feature Toggle Module to handle Feature Toggles o Implemented feature toggle module plus command line options etc. to activate feature and list available feature toggles. o Added example feature locatio

Posted by kh...@apache.org.
[MNG-6056] Implement Feature Toggle Module to handle Feature Toggles
 o Implemented feature toggle module plus command line options
   etc. to activate feature and list available feature toggles.
 o Added example feature locations which should be removed before
   really using it.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/1b3edccd
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/1b3edccd
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/1b3edccd

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 1b3edccd04189bed02cbd50ec47496829cccbf98
Parents: 9f2452a
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Sat Jul 2 22:47:46 2016 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Fri Aug 12 22:50:47 2016 +0200

----------------------------------------------------------------------
 maven-core/pom.xml                              |   4 +
 .../java/org/apache/maven/DefaultMaven.java     |  16 ++
 .../apache/maven/graph/DefaultGraphBuilder.java |  10 +
 maven-embedder/pom.xml                          |   4 +
 .../java/org/apache/maven/cli/CLIManager.java   |   6 +
 .../java/org/apache/maven/cli/MavenCli.java     | 234 +++++++++++++------
 .../java/org/apache/maven/cli/MavenCliTest.java |   1 +
 maven-feature/pom.xml                           |  62 +++++
 .../maven/feature/AvailableFeatureToggles.java  | 102 ++++++++
 .../maven/feature/DefaultFeatureToggles.java    |  82 +++++++
 .../apache/maven/feature/FeatureToggles.java    |  65 ++++++
 .../feature/AvailableFeatureTogglesTest.java    |  52 +++++
 .../feature/DefaultSelectedFeaturesTest.java    |  79 +++++++
 pom.xml                                         |   6 +
 14 files changed, 649 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-core/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index adf63a6..ec35f98 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -38,6 +38,10 @@ under the License.
   </properties>
 
   <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-feature</artifactId>
+    </dependency>
     <!--  Maven -->
     <dependency>
       <groupId>org.apache.maven</groupId>

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
index da17830..f4090d6 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -38,6 +38,8 @@ import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionResult;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.feature.AvailableFeatureToggles;
+import org.apache.maven.feature.FeatureToggles;
 import org.apache.maven.graph.GraphBuilder;
 import org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory;
 import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
@@ -92,6 +94,9 @@ public class DefaultMaven
 
     @Requirement
     private DefaultRepositorySystemSessionFactory repositorySessionFactory;
+    
+    @Requirement
+    private FeatureToggles selectedFeatures;
 
     @Requirement( hint = GraphBuilder.HINT )
     private GraphBuilder graphBuilder;
@@ -101,6 +106,17 @@ public class DefaultMaven
     {
         MavenExecutionResult result;
 
+        List<AvailableFeatureToggles> activatedFeatures = selectedFeatures.getActiveFeatureToggles();
+        if ( !activatedFeatures.isEmpty() )
+        {
+            logger.debug( "-------------------------------------------" );
+            for ( AvailableFeatureToggles feature : activatedFeatures )
+            {
+                logger.debug( "Feature: " + feature.name() + " has been activated by user request.");
+            }
+            logger.debug( "-------------------------------------------" );
+        }
+
         try
         {
             result = doExecute( request );

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java b/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
index 680d584..a41f6ba 100644
--- a/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
+++ b/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
@@ -36,6 +36,8 @@ import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionResult;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.feature.AvailableFeatureToggles;
+import org.apache.maven.feature.FeatureToggles;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.building.DefaultModelProblem;
 import org.apache.maven.model.building.ModelProblem;
@@ -65,6 +67,10 @@ public class DefaultGraphBuilder
 
     @Requirement
     protected ProjectBuilder projectBuilder;
+    
+    @Requirement
+    private FeatureToggles selectedFeatures;
+    
 
     @Override
     public Result<ProjectDependencyGraph> build( MavenSession session )
@@ -74,6 +80,10 @@ public class DefaultGraphBuilder
             return dependencyGraph( session, session.getProjects(), false );
         }
         
+        if (selectedFeatures.isToggleActive( AvailableFeatureToggles.MNG10000 )) {
+            logger.info( " -> Features MNG 10000 is activated." );
+        }
+
         List<MavenProject> projects = session.getProjects();
 
         if ( projects == null )

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-embedder/pom.xml
----------------------------------------------------------------------
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index f9973c5..12fb613 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -36,6 +36,10 @@ under the License.
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
+      <artifactId>maven-feature</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
       <artifactId>maven-builder-support</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
index f86f48b..a2cc344 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
@@ -100,6 +100,10 @@ public class CLIManager
     public static final String LEGACY_LOCAL_REPOSITORY = "llr";
 
     public static final String BUILDER = "b";
+    
+    public static final String LIST_FEATURES = "lf";
+    
+    public static final String ACTIVATE_FEATURES = "af";
 
     protected Options options;
 
@@ -140,6 +144,8 @@ public class CLIManager
         options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) );
         options.addOption( OptionBuilder.withLongOpt( "legacy-local-repository" ).withDescription( "Use Maven 2 Legacy Local Repository behaviour, ie no use of _remote.repositories. Can also be activated by using -Dmaven.legacyLocalRepo=true" ).create( LEGACY_LOCAL_REPOSITORY ) );
         options.addOption( OptionBuilder.withLongOpt( "builder" ).hasArg().withDescription( "The id of the build strategy to use" ).create( BUILDER ) );
+        options.addOption( OptionBuilder.withLongOpt( "list-features" ).withDescription( "List the exiting features which can be activated." ).create( LIST_FEATURES) );
+        options.addOption( OptionBuilder.withLongOpt( "activate-features" ).withDescription( "Comma-delimited list of features to be actived." ).hasArg().create( ACTIVATE_FEATURES ) );
 
         // Adding this back in for compatibility with the verifier that hard codes this option.
         options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) );

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 822f696..1b230df 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -41,10 +41,12 @@ import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
+
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.UnrecognizedOptionException;
 import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.text.WordUtils;
 import org.apache.maven.BuildAbort;
 import org.apache.maven.InternalErrorException;
 import org.apache.maven.Maven;
@@ -79,6 +81,8 @@ import org.apache.maven.execution.MavenExecutionRequestPopulator;
 import org.apache.maven.execution.MavenExecutionResult;
 import org.apache.maven.extension.internal.CoreExports;
 import org.apache.maven.extension.internal.CoreExtensionEntry;
+import org.apache.maven.feature.AvailableFeatureToggles;
+import org.apache.maven.feature.FeatureToggles;
 import org.apache.maven.lifecycle.LifecycleExecutionException;
 import org.apache.maven.model.Profile;
 import org.apache.maven.model.Repository;
@@ -105,13 +109,11 @@ import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.classworlds.ClassWorld;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
 import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
+import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.logging.LoggerManager;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
-import com.google.inject.AbstractModule;
 import org.eclipse.aether.transfer.TransferListener;
 import org.slf4j.ILoggerFactory;
 import org.slf4j.Logger;
@@ -122,6 +124,11 @@ import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
 import org.sonatype.plexus.components.sec.dispatcher.SecUtil;
 import org.sonatype.plexus.components.sec.dispatcher.model.SettingsSecurity;
 
+import com.google.common.base.Charsets;
+import com.google.common.base.Splitter;
+import com.google.common.io.Files;
+import com.google.inject.AbstractModule;
+
 // TODO: push all common bits back to plexus cli and prepare for transition to Guice. We don't need 50 ways to make CLIs
 
 /**
@@ -187,6 +194,9 @@ public class MavenCli
     private Map<String, ConfigurationProcessor> configurationProcessors;
 
     private ProfileSelector profileSelector;
+    
+    @Requirement
+    private FeatureToggles featureToggles;
 
     public MavenCli()
     {
@@ -228,8 +238,8 @@ public class MavenCli
     }
 
     /**
-     * This supports painless invocation by the Verifier during embedded execution of the core ITs.
-     * See <a href="http://maven.apache.org/shared/maven-verifier/xref/org/apache/maven/it/Embedded3xLauncher.html">
+     * This supports painless invocation by the Verifier during embedded execution of the core ITs. See
+     * <a href="http://maven.apache.org/shared/maven-verifier/xref/org/apache/maven/it/Embedded3xLauncher.html">
      * <code>Embedded3xLauncher</code> in <code>maven-verifier</code></a>
      */
     public int doMain( String[] args, String workingDirectory, PrintStream stdout, PrintStream stderr )
@@ -356,8 +366,7 @@ public class MavenCli
             String basedirProperty = System.getProperty( MULTIMODULE_PROJECT_DIRECTORY );
             if ( basedirProperty == null )
             {
-                System.err.format(
-                    "-D%s system property is not set.", MULTIMODULE_PROJECT_DIRECTORY );
+                System.err.format( "-D%s system property is not set.", MULTIMODULE_PROJECT_DIRECTORY );
                 throw new ExitException( 1 );
             }
             File basedir = basedirProperty != null ? new File( basedirProperty ) : new File( "" );
@@ -448,6 +457,48 @@ public class MavenCli
             System.out.println( CLIReportingUtils.showVersion() );
             throw new ExitException( 0 );
         }
+
+        if ( cliRequest.commandLine.hasOption( CLIManager.LIST_FEATURES ) )
+        {
+            AvailableFeatureToggles[] availableFeatures = AvailableFeatureToggles.getAvailableFeatureToggles();
+
+            if ( availableFeatures.length > 0 )
+            {
+                System.out.println( "" );
+                System.out.println( "Currently existing feature toggles which you can enable:" );
+                System.out.println( "" );
+                System.out.println( "Issue     Option   Description" );
+                System.out.println( "--------- -------- ----------------------------------------------------" );
+                for ( AvailableFeatureToggles feature : availableFeatures )
+                {
+                    String wrappedString = WordUtils.wrap( feature.getDescription(), 60 );
+                    List<String> splitToList = Splitter.on( System.lineSeparator() ).splitToList( wrappedString );
+                    for ( int i = 0; i < splitToList.size(); i++ )
+                    {
+                        if ( i == 0 )
+                        {
+                            System.out.print( String.format( "%-9s %-8s", feature.getIssue(), feature.name() ) + " " );
+                        }
+                        else
+                        {
+                            System.out.print( String.format( "%-9s %-8s", "", "" ) + " " );
+                        }
+                        System.out.println( splitToList.get( i ) );
+                    }
+                }
+
+                System.out.println( "" );
+                System.out.println( "If you like to know more about a particular issue please visit: issues.apache.org/jira/browse/[ISSUE]" );
+                throw new ExitException( 0 );
+            } 
+            else 
+            {
+                System.out.println( "" );
+                System.out.println( "There are no feature toggles available." );
+                throw new ExitException( 0 );
+                
+            }
+        }
     }
 
     /**
@@ -582,9 +633,8 @@ public class MavenCli
 
         ClassRealm containerRealm = setupContainerRealm( cliRequest.classWorld, coreRealm, extClassPath, extensions );
 
-        ContainerConfiguration cc = new DefaultContainerConfiguration().setClassWorld( cliRequest.classWorld ).setRealm(
-            containerRealm ).setClassPathScanning( PlexusConstants.SCANNING_INDEX ).setAutoWiring( true ).setName(
-            "maven" );
+        ContainerConfiguration cc =
+            new DefaultContainerConfiguration().setClassWorld( cliRequest.classWorld ).setRealm( containerRealm ).setClassPathScanning( PlexusConstants.SCANNING_INDEX ).setAutoWiring( true ).setName( "maven" );
 
         Set<String> exportedArtifacts = new HashSet<>( coreEntry.getExportedArtifacts() );
         Set<String> exportedPackages = new HashSet<>( coreEntry.getExportedPackages() );
@@ -622,6 +672,10 @@ public class MavenCli
 
         Thread.currentThread().setContextClassLoader( container.getContainerRealm() );
 
+        //Explicitly startup lookup for the component, cause it's used during command line
+        //parsing etc.
+        featureToggles = container.lookup( FeatureToggles.class );
+        
         eventSpyDispatcher = container.lookup( EventSpyDispatcher.class );
 
         DefaultEventSpyContext eventSpyContext = new DefaultEventSpyContext();
@@ -676,11 +730,11 @@ public class MavenCli
             }
 
             ContainerConfiguration cc = new DefaultContainerConfiguration() //
-                .setClassWorld( cliRequest.classWorld ) //
-                .setRealm( containerRealm ) //
-                .setClassPathScanning( PlexusConstants.SCANNING_INDEX ) //
-                .setAutoWiring( true ) //
-                .setName( "maven" );
+            .setClassWorld( cliRequest.classWorld ) //
+            .setRealm( containerRealm ) //
+            .setClassPathScanning( PlexusConstants.SCANNING_INDEX ) //
+            .setAutoWiring( true ) //
+            .setName( "maven" );
 
             DefaultPlexusContainer container = new DefaultPlexusContainer( cc, new AbstractModule()
             {
@@ -746,7 +800,7 @@ public class MavenCli
     {
         CoreExtensionsXpp3Reader parser = new CoreExtensionsXpp3Reader();
 
-        try ( InputStream is = new BufferedInputStream( new FileInputStream( extensionsFile ) ) )
+        try (InputStream is = new BufferedInputStream( new FileInputStream( extensionsFile ) ))
         {
 
             return parser.read( is ).getExtensions();
@@ -756,7 +810,7 @@ public class MavenCli
 
     private ClassRealm setupContainerRealm( ClassWorld classWorld, ClassRealm coreRealm, List<File> extClassPath,
                                             List<CoreExtensionEntry> extensions )
-        throws Exception
+                                                throws Exception
     {
         if ( !extClassPath.isEmpty() || !extensions.isEmpty() )
         {
@@ -852,8 +906,8 @@ public class MavenCli
 
             DefaultPlexusCipher cipher = new DefaultPlexusCipher();
 
-            System.out.println(
-                cipher.encryptAndDecorate( passwd, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) );
+            System.out.println( cipher.encryptAndDecorate( passwd,
+                                                           DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) );
 
             throw new ExitException( 0 );
         }
@@ -909,7 +963,7 @@ public class MavenCli
         throws Exception
     {
         if ( cliRequest.commandLine.hasOption( CLIManager.LEGACY_LOCAL_REPOSITORY )
-                 || Boolean.getBoolean( "maven.legacyLocalRepo" ) )
+            || Boolean.getBoolean( "maven.legacyLocalRepo" ) )
         {
             cliRequest.request.setUseLegacyLocalRepository( true );
         }
@@ -928,9 +982,8 @@ public class MavenCli
         profileActivationContext.setInactiveProfileIds( request.getInactiveProfiles() );
         profileActivationContext.setSystemProperties( request.getSystemProperties() );
         profileActivationContext.setUserProperties( request.getUserProperties() );
-        profileActivationContext.setProjectDirectory( request.getPom() != null
-                                                          ? request.getPom().getParentFile()
-                                                          : null );
+        profileActivationContext.setProjectDirectory( request.getPom() != null ? request.getPom().getParentFile()
+                        : null );
 
         final List<ModelProblem> modelProblems = new ArrayList<>();
         final List<Profile> activeProfiles =
@@ -941,10 +994,12 @@ public class MavenCli
                                                         @Override
                                                         public void add( final ModelProblemCollectorRequest req )
                                                         {
-                                                            modelProblems.add( new DefaultModelProblem(
-                                                                    req.getMessage(), req.getSeverity(),
-                                                                    req.getVersion(), Profile.SOURCE_SETTINGS, -1, -1,
-                                                                    null, req.getException() ) );
+                                                            modelProblems.add( new DefaultModelProblem( req.getMessage(),
+                                                                                                        req.getSeverity(),
+                                                                                                        req.getVersion(),
+                                                                                                        Profile.SOURCE_SETTINGS,
+                                                                                                        -1, -1, null,
+                                                                                                        req.getException() ) );
 
                                                         }
 
@@ -973,14 +1028,14 @@ public class MavenCli
                 {
                     try
                     {
-                        request.addRemoteRepository(
-                            MavenRepositorySystem.buildArtifactRepository( remoteRepository ) );
+                        request.addRemoteRepository( MavenRepositorySystem.buildArtifactRepository( remoteRepository ) );
 
                     }
                     catch ( final InvalidRepositoryException e )
                     {
                         slf4jLogger.warn( String.format( "Failure adding repository '%s' from profile '%s'.",
-                                                         remoteRepository.getId(), profile.getId() ), e );
+                                                         remoteRepository.getId(), profile.getId() ),
+                                          e );
 
                     }
                 }
@@ -991,14 +1046,14 @@ public class MavenCli
                 {
                     try
                     {
-                        request.addPluginArtifactRepository(
-                            MavenRepositorySystem.buildArtifactRepository( pluginRepository ) );
+                        request.addPluginArtifactRepository( MavenRepositorySystem.buildArtifactRepository( pluginRepository ) );
 
                     }
                     catch ( InvalidRepositoryException e )
                     {
                         slf4jLogger.warn( String.format( "Failure adding plugin repository '%s' from profile '%s'.",
-                                                         pluginRepository.getId(), profile.getId() ), e );
+                                                         pluginRepository.getId(), profile.getId() ),
+                                          e );
 
                     }
                 }
@@ -1056,7 +1111,7 @@ public class MavenCli
             {
                 slf4jLogger.error( "" );
                 slf4jLogger.error( "For more information about the errors and possible solutions"
-                                       + ", please read the following articles:" );
+                    + ", please read the following articles:" );
 
                 for ( Map.Entry<String, String> entry : references.entrySet() )
                 {
@@ -1068,8 +1123,7 @@ public class MavenCli
             {
                 slf4jLogger.error( "" );
                 slf4jLogger.error( "After correcting the problems, you can resume the build with the command" );
-                slf4jLogger.error( buffer().a( "  " ).strong( "mvn <goals> -rf :"
-                    + project.getArtifactId() ).toString() );
+                slf4jLogger.error( buffer().strong().a( "  mvn <goals> -rf :" ).a( project.getArtifactId() ).reset().toString() );
             }
 
             if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( cliRequest.request.getReactorFailureBehavior() ) )
@@ -1124,8 +1178,8 @@ public class MavenCli
         {
             String line = indent + lines[i].trim();
 
-            if ( ( i == lines.length - 1 ) && ( showErrors
-                || ( summary.getException() instanceof InternalErrorException ) ) )
+            if ( ( i == lines.length - 1 )
+                && ( showErrors || ( summary.getException() instanceof InternalErrorException ) ) )
             {
                 slf4jLogger.error( line, summary.getException() );
             }
@@ -1192,9 +1246,9 @@ public class MavenCli
             //
             // There are too many ConfigurationProcessors so we don't know which one to run so report the error.
             //
-            StringBuilder sb = new StringBuilder(
-                String.format( "\nThere can only be one user supplied ConfigurationProcessor, there are %s:\n\n",
-                               userSuppliedConfigurationProcessorCount ) );
+            StringBuilder sb =
+                new StringBuilder( String.format( "\nThere can only be one user supplied ConfigurationProcessor, there are %s:\n\n",
+                                                  userSuppliedConfigurationProcessorCount ) );
             for ( Entry<String, ConfigurationProcessor> entry : configurationProcessors.entrySet() )
             {
                 String hint = entry.getKey();
@@ -1223,8 +1277,8 @@ public class MavenCli
 
             if ( !userToolchainsFile.isFile() )
             {
-                throw new FileNotFoundException(
-                    "The specified user toolchains file does not exist: " + userToolchainsFile );
+                throw new FileNotFoundException( "The specified user toolchains file does not exist: "
+                    + userToolchainsFile );
             }
         }
         else
@@ -1242,8 +1296,8 @@ public class MavenCli
 
             if ( !globalToolchainsFile.isFile() )
             {
-                throw new FileNotFoundException(
-                    "The specified global toolchains file does not exist: " + globalToolchainsFile );
+                throw new FileNotFoundException( "The specified global toolchains file does not exist: "
+                    + globalToolchainsFile );
             }
         }
         else
@@ -1266,11 +1320,10 @@ public class MavenCli
 
         eventSpyDispatcher.onEvent( toolchainsRequest );
 
-        slf4jLogger.debug(
-            "Reading global toolchains from " + getLocation( toolchainsRequest.getGlobalToolchainsSource(),
-                                                             globalToolchainsFile ) );
-        slf4jLogger.debug( "Reading user toolchains from " + getLocation( toolchainsRequest.getUserToolchainsSource(),
-                                                                          userToolchainsFile ) );
+        slf4jLogger.debug( "Reading global toolchains from "
+            + getLocation( toolchainsRequest.getGlobalToolchainsSource(), globalToolchainsFile ) );
+        slf4jLogger.debug( "Reading user toolchains from "
+            + getLocation( toolchainsRequest.getUserToolchainsSource(), userToolchainsFile ) );
 
         ToolchainsBuildingResult toolchainsResult = toolchainsBuilder.build( toolchainsRequest );
 
@@ -1320,7 +1373,7 @@ public class MavenCli
             if ( commandLine.hasOption( deprecatedOption ) )
             {
                 slf4jLogger.warn( "Command line option -" + deprecatedOption
-                                      + " is deprecated and will be removed in future Maven versions." );
+                    + " is deprecated and will be removed in future Maven versions." );
             }
         }
 
@@ -1474,19 +1527,20 @@ public class MavenCli
             userToolchainsFile = MavenCli.DEFAULT_USER_TOOLCHAINS_FILE;
         }
 
-        request.setBaseDirectory( baseDirectory ).setGoals( goals ).setSystemProperties(
-            cliRequest.systemProperties ).setUserProperties( cliRequest.userProperties ).setReactorFailureBehavior(
-            reactorFailureBehaviour ) // default: fail fast
-            .setRecursive( recursive ) // default: true
-            .setShowErrors( showErrors ) // default: false
-            .addActiveProfiles( activeProfiles ) // optional
-            .addInactiveProfiles( inactiveProfiles ) // optional
-            .setExecutionListener( executionListener ).setTransferListener(
-            transferListener ) // default: batch mode which goes along with interactive
-            .setUpdateSnapshots( updateSnapshots ) // default: false
-            .setNoSnapshotUpdates( noSnapshotUpdates ) // default: false
-            .setGlobalChecksumPolicy( globalChecksumPolicy ) // default: warn
-            .setMultiModuleProjectDirectory( cliRequest.multiModuleProjectDirectory );
+        request.setBaseDirectory( baseDirectory ).setGoals( goals ).setSystemProperties( cliRequest.systemProperties ).setUserProperties( cliRequest.userProperties ).setReactorFailureBehavior( reactorFailureBehaviour ) // default:
+                                                                                                                                                                                                                           // fail
+                                                                                                                                                                                                                           // fast
+        .setRecursive( recursive ) // default: true
+        .setShowErrors( showErrors ) // default: false
+        .addActiveProfiles( activeProfiles ) // optional
+        .addInactiveProfiles( inactiveProfiles ) // optional
+        .setExecutionListener( executionListener ).setTransferListener( transferListener ) // default: batch mode which
+                                                                                           // goes along with
+                                                                                           // interactive
+        .setUpdateSnapshots( updateSnapshots ) // default: false
+        .setNoSnapshotUpdates( noSnapshotUpdates ) // default: false
+        .setGlobalChecksumPolicy( globalChecksumPolicy ) // default: warn
+        .setMultiModuleProjectDirectory( cliRequest.multiModuleProjectDirectory );
 
         if ( alternatePomFile != null )
         {
@@ -1555,18 +1609,18 @@ public class MavenCli
             request.setExcludedProjects( exclProjects );
         }
 
-        if ( commandLine.hasOption( CLIManager.ALSO_MAKE ) && !commandLine.hasOption(
-            CLIManager.ALSO_MAKE_DEPENDENTS ) )
+        if ( commandLine.hasOption( CLIManager.ALSO_MAKE )
+            && !commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) )
         {
             request.setMakeBehavior( MavenExecutionRequest.REACTOR_MAKE_UPSTREAM );
         }
-        else if ( !commandLine.hasOption( CLIManager.ALSO_MAKE ) && commandLine.hasOption(
-            CLIManager.ALSO_MAKE_DEPENDENTS ) )
+        else if ( !commandLine.hasOption( CLIManager.ALSO_MAKE )
+            && commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) )
         {
             request.setMakeBehavior( MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM );
         }
-        else if ( commandLine.hasOption( CLIManager.ALSO_MAKE ) && commandLine.hasOption(
-            CLIManager.ALSO_MAKE_DEPENDENTS ) )
+        else if ( commandLine.hasOption( CLIManager.ALSO_MAKE )
+            && commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) )
         {
             request.setMakeBehavior( MavenExecutionRequest.REACTOR_MAKE_BOTH );
         }
@@ -1594,10 +1648,13 @@ public class MavenCli
         // parameters but this is sufficient for now. Ultimately we want components like Builders to provide a way to
         // extend the command line to accept its own configuration parameters.
         //
-        final String threadConfiguration = commandLine.hasOption( CLIManager.THREADS )
-            ? commandLine.getOptionValue( CLIManager.THREADS )
-            : request.getSystemProperties().getProperty(
-                MavenCli.THREADS_DEPRECATED ); // TODO: Remove this setting. Note that the int-tests use it
+        final String threadConfiguration =
+            commandLine.hasOption( CLIManager.THREADS ) ? commandLine.getOptionValue( CLIManager.THREADS )
+                            : request.getSystemProperties().getProperty( MavenCli.THREADS_DEPRECATED ); // TODO: Remove
+                                                                                                        // this setting.
+                                                                                                        // Note that the
+                                                                                                        // int-tests use
+                                                                                                        // it
 
         if ( threadConfiguration != null )
         {
@@ -1624,6 +1681,35 @@ public class MavenCli
             request.setBuilderId( commandLine.getOptionValue( CLIManager.BUILDER ) );
         }
 
+        if ( commandLine.hasOption( CLIManager.ACTIVATE_FEATURES ) )
+        {
+            String activateFeaturesOptionValue = commandLine.getOptionValue( CLIManager.ACTIVATE_FEATURES );
+
+            List<AvailableFeatureToggles> activatedFeatures = new ArrayList<>();
+
+            if ( activateFeaturesOptionValue != null )
+            {
+                StringTokenizer featureTokens = new StringTokenizer( activateFeaturesOptionValue, "," );
+
+                while ( featureTokens.hasMoreTokens() )
+                {
+                    String featureToken = featureTokens.nextToken().trim();
+
+                    try
+                    {
+                        AvailableFeatureToggles resultingFeature = AvailableFeatureToggles.valueOf( featureToken.toUpperCase() );
+                        activatedFeatures.add( resultingFeature );
+                    }
+                    catch ( java.lang.IllegalArgumentException e )
+                    {
+                        slf4jLogger.warn( "The requested feature '" + featureToken + "' Does not exist." );
+                    }
+                }
+            }
+
+            featureToggles.setActivatedFeatureToggles( activatedFeatures );
+        }
+
         return request;
     }
 

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
index d926624..dc3496f 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
@@ -22,6 +22,7 @@ package org.apache.maven.cli;
 import java.io.File;
 
 import org.apache.commons.cli.ParseException;
+import org.apache.maven.feature.AvailableFeatureToggles;
 
 import junit.framework.TestCase;
 

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-feature/pom.xml
----------------------------------------------------------------------
diff --git a/maven-feature/pom.xml b/maven-feature/pom.xml
new file mode 100644
index 0000000..0ddd5fc
--- /dev/null
+++ b/maven-feature/pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven</artifactId>
+    <version>3.4.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-feature</artifactId>
+
+  <name>Maven Feature</name>
+  <description>Feature Toggle Module. Can be used in any other module.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.eclipse.sisu</groupId>
+      <artifactId>org.eclipse.sisu.plexus</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-component-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-component-metadata</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-feature/src/main/java/org/apache/maven/feature/AvailableFeatureToggles.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/main/java/org/apache/maven/feature/AvailableFeatureToggles.java b/maven-feature/src/main/java/org/apache/maven/feature/AvailableFeatureToggles.java
new file mode 100644
index 0000000..9bdf41c
--- /dev/null
+++ b/maven-feature/src/main/java/org/apache/maven/feature/AvailableFeatureToggles.java
@@ -0,0 +1,102 @@
+package org.apache.maven.feature;
+
+import java.util.Arrays;
+import java.util.List;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
+ *
+ * @since 3.4.0
+ */
+public enum AvailableFeatureToggles
+{
+
+    //FIXME: Only some examples given. Nothing which exists in reality.
+
+    /**
+     * MNG9991 this feature toggle is intended to do the following.. 
+     */
+    MNG9991( "MNG-9991", "First Feature to be toggable via command line option. "
+        + "First Feature to be toggable via command line option." ),
+    /**
+     * MNG9992 this feature toggle is intended to do the following.. 
+     */
+    MNG9992( "MNG-9992", "First Feature to be toggable via command line option. "
+        + "First Feature to be toggable via command line option. XX asdfa. asdf dsf." ),
+    /**
+     * MNG9993 this feature toggle is intended to do the following.. 
+     */
+    MNG9993( "MNG-9993", "First Feature to be toggable via command line option. "
+        + "More text than you think." ),
+    /**
+     * MNG10000 this feature toggle is intended to do the following.. 
+     */
+    MNG10000( "MNG-10000", "First Feature to be toggable via command line option. "
+        + "Here much more than you thing." ),
+
+    /**
+     * This is an feature toggle which will never being used nor does it exist.
+     * This is only to mark the end of feature toggles. Also used for unit tests.
+     * Furthermore by using this you can remove all other features but this
+     * type keep a single entry. 
+     * 
+     * Keep it at the last position in this enumeration.
+     */
+    UNKNOWN ("UNKNOWN", "The unknown feature.");
+
+    private String issue;
+
+    private String description;
+
+    private AvailableFeatureToggles( String issue, String description )
+    {
+        this.issue = issue;
+        this.description = description;
+    }
+
+    /**
+     * @return The list of features without {@code #UNKNOWN}.
+     */
+    public static AvailableFeatureToggles[] getAvailableFeatureToggles() {
+        List<AvailableFeatureToggles> asList = Arrays.asList( AvailableFeatureToggles.values());
+
+        AvailableFeatureToggles[] result = new AvailableFeatureToggles[asList.size() - 1];
+        
+        for ( int i = 0; i < asList.size() - 1; i++ )
+        {
+            if (asList.get( i ) != UNKNOWN) {
+                result[i] = asList.get( i );
+            }
+        }
+        return result;
+    }
+    
+    public String getDescription()
+    {
+        return this.description;
+    }
+
+    public String getIssue()
+    {
+        return this.issue;
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java b/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
new file mode 100644
index 0000000..2f75fbe
--- /dev/null
+++ b/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
@@ -0,0 +1,82 @@
+package org.apache.maven.feature;
+
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * This implements features toggles which can activated or 
+ * asked if a particular feature toggle is active or not.
+ * 
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
+ *
+ * @since 3.4.0
+ */
+@Component( instantiationStrategy = "singleton", role = FeatureToggles.class )
+public class DefaultFeatureToggles
+    implements FeatureToggles
+{
+    @Requirement
+    private Logger logger;
+
+    private List<AvailableFeatureToggles> activatedFeatureToggles;
+
+    /** {@inheritDoc} */
+    public void setActivatedFeatureToggles( List<AvailableFeatureToggles> featuresToBeActivated )
+    {
+        if ( featuresToBeActivated == null )
+        {
+            this.activatedFeatureToggles = new ArrayList<>();
+        }
+        else
+        {
+            this.activatedFeatureToggles = featuresToBeActivated;
+        }
+    }
+
+    /** {@inheritDoc} */
+    public boolean isToggleActive( AvailableFeatureToggles feature )
+    {
+        if ( activatedFeatureToggles != null )
+        {
+            return activatedFeatureToggles.contains( feature );
+        }
+        return false;
+    }
+
+    public List<AvailableFeatureToggles> getActiveFeatureToggles()
+    {
+        if ( activatedFeatureToggles == null )
+        {
+            return Collections.emptyList();
+        }
+        else
+        {
+            return activatedFeatureToggles;
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-feature/src/main/java/org/apache/maven/feature/FeatureToggles.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/main/java/org/apache/maven/feature/FeatureToggles.java b/maven-feature/src/main/java/org/apache/maven/feature/FeatureToggles.java
new file mode 100644
index 0000000..415dc75
--- /dev/null
+++ b/maven-feature/src/main/java/org/apache/maven/feature/FeatureToggles.java
@@ -0,0 +1,65 @@
+package org.apache.maven.feature;
+
+/*
+ * 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.
+ */
+
+import java.util.List;
+
+/**
+ * This gives access to the feature toggles which can be used during the run of Maven.
+ * 
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
+ * @since 3.4.0
+ */
+public interface FeatureToggles
+{
+
+    /**
+     * @return The list of features which will be activated.
+     * @see AvailableFeatureToggles
+     * @since 3.4.0
+     */
+    void setActivatedFeatureToggles( List<AvailableFeatureToggles> activatedFeatures );
+
+    /**
+     * Example code looks like this:
+     * <pre>
+     * <code>
+     *  if (feature.isToggleActive( AvailableFeatureToggles.MNG10000 )) {
+     *      // Do what is needed for the particular feature
+     *  }
+     * </code>
+     * </pre>
+     * 
+     * @param feature The feature toggle to check for if it is activated or not.
+     * @return <code>true</code> in case of feature has been activated via command line.
+     *         <code>--activate-features MNG10000</code>, <code>false</code> otherwise.
+     * @see AvailableFeatureToggles
+     * @since 3.4.0
+     */
+    boolean isToggleActive( AvailableFeatureToggles feature );
+
+    /**
+     * @return The list of feature toggles which have been activated.
+     * @see AvailableFeatureToggles
+     * @since 3.4.0
+     */
+    List<AvailableFeatureToggles> getActiveFeatureToggles();
+
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-feature/src/test/java/org/apache/maven/feature/AvailableFeatureTogglesTest.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/test/java/org/apache/maven/feature/AvailableFeatureTogglesTest.java b/maven-feature/src/test/java/org/apache/maven/feature/AvailableFeatureTogglesTest.java
new file mode 100644
index 0000000..b00b80d
--- /dev/null
+++ b/maven-feature/src/test/java/org/apache/maven/feature/AvailableFeatureTogglesTest.java
@@ -0,0 +1,52 @@
+package org.apache.maven.feature;
+
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+/**
+ * This implements some checks on the enumeration type.
+ * 
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
+ * @since 3.4.0
+ */
+public class AvailableFeatureTogglesTest
+{
+
+    @Test
+    public void getAvailableFeatureToggolesShouldReturnFour()
+    {
+        assertEquals( 4, AvailableFeatureToggles.getAvailableFeatureToggles().length );
+    }
+
+    @Test
+    public void getAvailableFeatureTogglesShouldReturnCorrectValues()
+    {
+        AvailableFeatureToggles[] aft = AvailableFeatureToggles.getAvailableFeatureToggles();
+
+        assertEquals( AvailableFeatureToggles.MNG9991, aft[0] );
+        assertEquals( AvailableFeatureToggles.MNG9992, aft[1] );
+        assertEquals( AvailableFeatureToggles.MNG9993, aft[2] );
+        assertEquals( AvailableFeatureToggles.MNG10000, aft[3] );
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/maven-feature/src/test/java/org/apache/maven/feature/DefaultSelectedFeaturesTest.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/test/java/org/apache/maven/feature/DefaultSelectedFeaturesTest.java b/maven-feature/src/test/java/org/apache/maven/feature/DefaultSelectedFeaturesTest.java
new file mode 100644
index 0000000..7400196
--- /dev/null
+++ b/maven-feature/src/test/java/org/apache/maven/feature/DefaultSelectedFeaturesTest.java
@@ -0,0 +1,79 @@
+package org.apache.maven.feature;
+
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This implements some unit tests for checking the behaviour of the implementation.
+ * 
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
+ * @since 3.4.0
+ */
+public class DefaultSelectedFeaturesTest
+{
+    private FeatureToggles sf;
+
+    @Before
+    public void before()
+    {
+        sf = new DefaultFeatureToggles();
+    }
+
+    @Test
+    public void getActiveFeaturesShouldNotReturnNotNullAndSizeOfListZero()
+    {
+        assertNotNull( sf.getActiveFeatureToggles() );
+        assertEquals( sf.getActiveFeatureToggles().size(), 0 );
+    }
+
+    @Test
+    public void isToggleActiveShouldReturnFalseIfNoTogglesHadBeenActivatedAtAll()
+    {
+        assertFalse( sf.isToggleActive( AvailableFeatureToggles.UNKNOWN ) );
+    }
+
+    @Test
+    public void isToggleActiveShouldReturnFalseIfNotTheCorrectFeatureIsActivated()
+    {
+        sf.setActivatedFeatureToggles( Arrays.asList( AvailableFeatureToggles.UNKNOWN ) );
+        assertFalse( sf.isToggleActive( AvailableFeatureToggles.MNG10000 ) );
+        assertTrue( sf.isToggleActive( AvailableFeatureToggles.UNKNOWN ) );
+    }
+
+
+    @Test
+    public void getActiveFeatureTogglesShouldReturnFalse()
+    {
+        List<AvailableFeatureToggles> activeFeatureToggles = sf.getActiveFeatureToggles();
+        assertEquals( 2, activeFeatureToggles.size() );
+        assertFalse( sf.isToggleActive( AvailableFeatureToggles.MNG10000 ) );
+        assertTrue( sf.isToggleActive( AvailableFeatureToggles.UNKNOWN ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/1b3edccd/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 861b915..cc6d9b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,6 +81,7 @@ under the License.
   </properties>
 
   <modules>
+    <module>maven-feature</module>
     <module>maven-plugin-api</module>
     <module>maven-builder-support</module>
     <module>maven-model</module>
@@ -165,6 +166,11 @@ under the License.
   <dependencyManagement>
     <!--bootstrap-end-comment-->
     <dependencies>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-feature</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <!--  Maven Modules -->
       <!--bootstrap-start-comment-->
       <dependency>


[33/33] maven git commit: Merge branch 'MNG-6056-feature-toggle' of https://git-wip-us.apache.org/repos/asf/maven into MNG-6056-feature-toggle

Posted by kh...@apache.org.
Merge branch 'MNG-6056-feature-toggle' of https://git-wip-us.apache.org/repos/asf/maven into MNG-6056-feature-toggle


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/626a0406
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/626a0406
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/626a0406

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 626a0406bf98fd1818da687bc7c446956b556711
Parents: fd0a6b3 4298b51
Author: khmarbaise <kh...@apache.org>
Authored: Sat Sep 24 17:18:41 2016 +0200
Committer: khmarbaise <kh...@apache.org>
Committed: Sat Sep 24 17:18:41 2016 +0200

----------------------------------------------------------------------
 maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java  | 2 +-
 .../src/test/java/org/apache/maven/cli/MavenCliTest.java           | 1 -
 .../main/java/org/apache/maven/feature/DefaultFeatureToggles.java  | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/626a0406/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/maven/blob/626a0406/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
----------------------------------------------------------------------
diff --cc maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
index dc3496f,9f18c4b..aef6d3f
--- a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
@@@ -21,10 -21,10 +21,9 @@@ package org.apache.maven.cli
  
  import java.io.File;
  
 -import junit.framework.TestCase;
 -
  import org.apache.commons.cli.ParseException;
  import org.apache.maven.feature.AvailableFeatureToggles;
- 
 +import junit.framework.TestCase;
  
  public class MavenCliTest
      extends TestCase


[02/33] maven git commit: Fixed checkstyle reported errors.

Posted by kh...@apache.org.
Fixed checkstyle reported errors.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/22708528
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/22708528
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/22708528

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 227085283b6379038ec16f4cf9ad2e8869cef694
Parents: dca6a2c
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Tue Jul 5 23:13:26 2016 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Tue Jul 5 23:13:26 2016 +0200

----------------------------------------------------------------------
 .../model/building/DefaultModelBuilder.java     | 243 +++++++++----------
 1 file changed, 111 insertions(+), 132 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/22708528/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 6eccffa..0224367 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -339,13 +339,11 @@ public class DefaultModelBuilder
             }
             else if ( currentData == resultData )
             { // First iteration - add initial id after version resolution.
-                currentData.setGroupId( currentData.getRawModel().getGroupId() == null
-                                            ? parentData.getGroupId()
-                                            : currentData.getRawModel().getGroupId() );
+                currentData.setGroupId( currentData.getRawModel().getGroupId() == null ? parentData.getGroupId()
+                                : currentData.getRawModel().getGroupId() );
 
-                currentData.setVersion( currentData.getRawModel().getVersion() == null
-                                            ? parentData.getVersion()
-                                            : currentData.getRawModel().getVersion() );
+                currentData.setVersion( currentData.getRawModel().getVersion() == null ? parentData.getVersion()
+                                : currentData.getRawModel().getVersion() );
 
                 currentData.setArtifactId( currentData.getRawModel().getArtifactId() );
                 parentIds.add( currentData.getId() );
@@ -364,9 +362,8 @@ public class DefaultModelBuilder
                 }
                 message += parentData.getId();
 
-                problems.add( new ModelProblemCollectorRequest( ModelProblem.Severity.FATAL,
-                                                                ModelProblem.Version.BASE ).
-                    setMessage( message ) );
+                problems.add( new ModelProblemCollectorRequest( ModelProblem.Severity.FATAL, ModelProblem.Version.BASE )
+                    .setMessage( message ) );
 
                 throw problems.newModelBuildingException();
             }
@@ -519,9 +516,8 @@ public class DefaultModelBuilder
     @Override
     public Result<? extends Model> buildRawModel( File pomFile, int validationLevel, boolean locationTracking )
     {
-        final ModelBuildingRequest request = new DefaultModelBuildingRequest().
-            setValidationLevel( validationLevel ).
-            setLocationTracking( locationTracking );
+        final ModelBuildingRequest request = new DefaultModelBuildingRequest().setValidationLevel( validationLevel )
+            .setLocationTracking( locationTracking );
 
         final DefaultModelProblemCollector collector =
             new DefaultModelProblemCollector( new DefaultModelBuildingResult() );
@@ -538,7 +534,7 @@ public class DefaultModelBuilder
 
     private Model readModel( ModelSource modelSource, File pomFile, ModelBuildingRequest request,
                              DefaultModelProblemCollector problems )
-        throws ModelBuildingException
+                                 throws ModelBuildingException
     {
         Model model;
 
@@ -590,16 +586,16 @@ public class DefaultModelBuilder
 
                 if ( pomFile != null )
                 {
-                    problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.V20 ).
-                        setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() ).
-                        setException( e ) );
+                    problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.V20 )
+                        .setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() )
+                        .setException( e ) );
 
                 }
                 else
                 {
-                    problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ).
-                        setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() ).
-                        setException( e ) );
+                    problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 )
+                        .setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() )
+                        .setException( e ) );
 
                 }
             }
@@ -612,9 +608,9 @@ public class DefaultModelBuilder
         }
         catch ( ModelParseException e )
         {
-            problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE ).
-                setMessage( "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage() ).
-                setException( e ) );
+            problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
+                .setMessage( "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage() )
+                .setException( e ) );
 
             throw problems.newModelBuildingException();
         }
@@ -635,9 +631,8 @@ public class DefaultModelBuilder
                 }
             }
 
-            problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE ).
-                setMessage( "Non-readable POM " + modelSource.getLocation() + ": " + msg ).
-                setException( e ) );
+            problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
+                .setMessage( "Non-readable POM " + modelSource.getLocation() + ": " + msg ).setException( e ) );
 
             throw problems.newModelBuildingException();
         }
@@ -691,10 +686,9 @@ public class DefaultModelBuilder
                 }
                 catch ( InvalidRepositoryException e )
                 {
-                    problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).
-                        setMessage( "Invalid repository " + repository.getId() + ": " + e.getMessage() ).
-                        setLocation( repository.getLocation( "" ) ).
-                        setException( e ) );
+                    problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+                        .setMessage( "Invalid repository " + repository.getId() + ": " + e.getMessage() )
+                        .setLocation( repository.getLocation( "" ) ).setException( e ) );
 
                 }
             }
@@ -745,9 +739,9 @@ public class DefaultModelBuilder
                 if ( versions.get( key ) == null && managedVersions.get( key ) == null )
                 {
                     InputLocation location = plugins.get( key ).getLocation( "" );
-                    problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ).
-                        setMessage( "'build.plugins.plugin.version' for " + key + " is missing." ).
-                        setLocation( location ) );
+                    problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 )
+                        .setMessage( "'build.plugins.plugin.version' for " + key + " is missing." )
+                        .setLocation( location ) );
 
                 }
             }
@@ -845,7 +839,7 @@ public class DefaultModelBuilder
             {
 
                 @Override
-                public int getValidationLevel()
+                public int getValidationLevel( )
                 {
                     return ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0;
                 }
@@ -917,7 +911,8 @@ public class DefaultModelBuilder
         // save profile activations before interpolation, since they are evaluated with limited scope
         Map<String, Activation> originalActivations = getProfileActivations( model, true );
 
-        Model interpolatedModel = modelInterpolator.interpolateModel( model, model.getProjectDirectory(), request, problems );
+        Model interpolatedModel =
+            modelInterpolator.interpolateModel( model, model.getProjectDirectory(), request, problems );
         if ( interpolatedModel.getParent() != null )
         {
             StringSearchInterpolator ssi = new StringSearchInterpolator();
@@ -936,8 +931,8 @@ public class DefaultModelBuilder
             {
                 ModelProblemCollectorRequest mpcr = new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
                     .setMessage(
-                                "Failed to interpolate field: " + interpolatedModel.getParent().getVersion() + " on class: "
-                                    ).setException(e );
+                        "Failed to interpolate field: " + interpolatedModel.getParent().getVersion() + " on class: " )
+                    .setException( e );
                 problems.add( mpcr );
             }
 
@@ -952,7 +947,7 @@ public class DefaultModelBuilder
 
     private ModelData readParent( Model childModel, ModelSource childSource, ModelBuildingRequest request,
                                   DefaultModelProblemCollector problems )
-        throws ModelBuildingException
+                                      throws ModelBuildingException
     {
         ModelData parentData;
 
@@ -992,7 +987,7 @@ public class DefaultModelBuilder
                     ModelSource expectedParentSource = getParentPomFile( childModel, childSource );
 
                     if ( expectedParentSource instanceof ModelSource2
-                             && !pomFile.toURI().equals( ( (ModelSource2) expectedParentSource ).getLocationURI() ) )
+                        && !pomFile.toURI().equals( ( (ModelSource2) expectedParentSource ).getLocationURI() ) )
                     {
                         parentData = readParentExternally( childModel, request, problems );
                     }
@@ -1003,10 +998,10 @@ public class DefaultModelBuilder
 
             if ( !"pom".equals( parentModel.getPackaging() ) )
             {
-                problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).
-                    setMessage( "Invalid packaging for parent POM " + ModelProblemUtils.toSourceHint( parentModel )
-                                    + ", must be \"pom\" but is \"" + parentModel.getPackaging() + "\"" ).
-                    setLocation( parentModel.getLocation( "packaging" ) ) );
+                problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+                    .setMessage( "Invalid packaging for parent POM " + ModelProblemUtils.toSourceHint( parentModel )
+                        + ", must be \"pom\" but is \"" + parentModel.getPackaging() + "\"" )
+                    .setLocation( parentModel.getLocation( "packaging" ) ) );
 
             }
         }
@@ -1020,7 +1015,7 @@ public class DefaultModelBuilder
 
     private ModelData readParentLocally( Model childModel, ModelSource childSource, ModelBuildingRequest request,
                                          DefaultModelProblemCollector problems )
-        throws ModelBuildingException
+                                             throws ModelBuildingException
     {
         final Parent parent = childModel.getParent();
         final ModelSource candidateSource;
@@ -1053,10 +1048,9 @@ public class DefaultModelBuilder
             }
             catch ( UnresolvableModelException e )
             {
-                problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE ).
-                    setMessage( e.getMessage().toString() ).
-                    setLocation( parent.getLocation( "" ) ).
-                    setException( e ) );
+                problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
+                    .setMessage( e.getMessage().toString() ).setLocation( parent.getLocation( "" ) )
+                    .setException( e ) );
 
                 throw problems.newModelBuildingException();
             }
@@ -1085,7 +1079,7 @@ public class DefaultModelBuilder
         }
 
         if ( groupId == null || !groupId.equals( parent.getGroupId() ) || artifactId == null
-                 || !artifactId.equals( parent.getArtifactId() ) )
+            || !artifactId.equals( parent.getArtifactId() ) )
         {
             StringBuilder buffer = new StringBuilder( 256 );
             buffer.append( "'parent.relativePath'" );
@@ -1098,9 +1092,8 @@ public class DefaultModelBuilder
             buffer.append( parent.getArtifactId() ).append( ", please verify your project structure" );
 
             problems.setSource( childModel );
-            problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE ).
-                setMessage( buffer.toString() ).
-                setLocation( parent.getLocation( "" ) ) );
+            problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE )
+                .setMessage( buffer.toString() ).setLocation( parent.getLocation( "" ) ) );
 
             return null;
         }
@@ -1123,18 +1116,17 @@ public class DefaultModelBuilder
                 // Validate versions aren't inherited when using parent ranges the same way as when read externally.
                 if ( childModel.getVersion() == null )
                 {
-                    problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 ).
-                        setMessage( "Version must be a constant" ).
-                        setLocation( childModel.getLocation( "" ) ) );
+                    problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 )
+                        .setMessage( "Version must be a constant" ).setLocation( childModel.getLocation( "" ) ) );
 
                 }
                 else
                 {
                     if ( childModel.getVersion().contains( "${" ) )
                     {
-                        problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 ).
-                            setMessage( "Version must be a constant" ).
-                            setLocation( childModel.getLocation( "version" ) ) );
+                        problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 )
+                            .setMessage( "Version must be a constant" )
+                            .setLocation( childModel.getLocation( "version" ) ) );
 
                     }
                 }
@@ -1180,7 +1172,7 @@ public class DefaultModelBuilder
 
     private ModelData readParentExternally( Model childModel, ModelBuildingRequest request,
                                             DefaultModelProblemCollector problems )
-        throws ModelBuildingException
+                                                throws ModelBuildingException
     {
         problems.setSource( childModel );
 
@@ -1193,8 +1185,7 @@ public class DefaultModelBuilder
         ModelResolver modelResolver = request.getModelResolver();
 
         Validate.notNull( modelResolver, "request.modelResolver cannot be null (parent POM %s and POM %s)",
-                          ModelProblemUtils.toId( groupId, artifactId, version ),
-                          ModelProblemUtils.toSourceHint( childModel ) );
+            ModelProblemUtils.toId( groupId, artifactId, version ), ModelProblemUtils.toSourceHint( childModel ) );
 
         ModelSource modelSource;
         try
@@ -1226,10 +1217,8 @@ public class DefaultModelBuilder
                 }
             }
 
-            problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE ).
-                setMessage( buffer.toString() ).
-                setLocation( parent.getLocation( "" ) ).
-                setException( e ) );
+            problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
+                .setMessage( buffer.toString() ).setLocation( parent.getLocation( "" ) ).setException( e ) );
 
             throw problems.newModelBuildingException();
         }
@@ -1241,7 +1230,7 @@ public class DefaultModelBuilder
             {
 
                 @Override
-                public int getValidationLevel()
+                public int getValidationLevel( )
                 {
                     return ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0;
                 }
@@ -1255,18 +1244,17 @@ public class DefaultModelBuilder
         {
             if ( childModel.getVersion() == null )
             {
-                problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 ).
-                    setMessage( "Version must be a constant" ).
-                    setLocation( childModel.getLocation( "" ) ) );
+                problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 )
+                    .setMessage( "Version must be a constant" ).setLocation( childModel.getLocation( "" ) ) );
 
             }
             else
             {
                 if ( childModel.getVersion().contains( "${" ) )
                 {
-                    problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 ).
-                        setMessage( "Version must be a constant" ).
-                        setLocation( childModel.getLocation( "version" ) ) );
+                    problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 )
+                        .setMessage( "Version must be a constant" )
+                        .setLocation( childModel.getLocation( "version" ) ) );
 
                 }
             }
@@ -1274,8 +1262,8 @@ public class DefaultModelBuilder
             // MNG-2199: What else to check here ?
         }
 
-        ModelData parentData = new ModelData( modelSource, parentModel, parent.getGroupId(), parent.getArtifactId(),
-                                              parent.getVersion() );
+        ModelData parentData =
+            new ModelData( modelSource, parentModel, parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
 
         return parentData;
     }
@@ -1322,26 +1310,26 @@ public class DefaultModelBuilder
                 {
                     problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
                         .setMessage( "'dependencyManagement.dependencies.dependency.groupId' for "
-                                         + dependency.getManagementKey() + " is missing." )
+                            + dependency.getManagementKey() + " is missing." )
                         .setLocation( dependency.getLocation( "" ) ) );
 
                     continue;
                 }
                 if ( artifactId == null || artifactId.length() <= 0 )
                 {
-                    problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).
-                        setMessage( "'dependencyManagement.dependencies.dependency.artifactId' for "
-                                        + dependency.getManagementKey() + " is missing." ).
-                        setLocation( dependency.getLocation( "" ) ) );
+                    problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+                        .setMessage( "'dependencyManagement.dependencies.dependency.artifactId' for "
+                            + dependency.getManagementKey() + " is missing." )
+                        .setLocation( dependency.getLocation( "" ) ) );
 
                     continue;
                 }
                 if ( version == null || version.length() <= 0 )
                 {
-                    problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).
-                        setMessage( "'dependencyManagement.dependencies.dependency.version' for "
-                                        + dependency.getManagementKey() + " is missing." ).
-                        setLocation( dependency.getLocation( "" ) ) );
+                    problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+                        .setMessage( "'dependencyManagement.dependencies.dependency.version' for "
+                            + dependency.getManagementKey() + " is missing." )
+                        .setLocation( dependency.getLocation( "" ) ) );
 
                     continue;
                 }
@@ -1356,14 +1344,14 @@ public class DefaultModelBuilder
                         message += modelId + " -> ";
                     }
                     message += imported;
-                    problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).
-                        setMessage( message ) );
+                    problems
+                        .add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage( message ) );
 
                     continue;
                 }
 
-                DependencyManagement importMngt = getCache( request.getModelCache(), groupId, artifactId, version,
-                                                            ModelCacheTag.IMPORT );
+                DependencyManagement importMngt =
+                    getCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.IMPORT );
 
                 if ( importMngt == null )
                 {
@@ -1386,9 +1374,8 @@ public class DefaultModelBuilder
                         }
                         catch ( UnresolvableModelException e )
                         {
-                            problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE ).
-                                setMessage( e.getMessage() ).
-                                setException( e ) );
+                            problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
+                                .setMessage( e.getMessage() ).setException( e ) );
 
                             continue;
                         }
@@ -1406,8 +1393,7 @@ public class DefaultModelBuilder
                     }
 
                     importMngt = importModel.getDependencyManagement() != null
-                                     ? importModel.getDependencyManagement().clone()
-                                     : new DependencyManagement();
+                                    ? importModel.getDependencyManagement().clone() : new DependencyManagement();
 
                     // [MNG-5600] Dependency management import should support exclusions.
                     if ( !dependency.getExclusions().isEmpty() )
@@ -1416,15 +1402,15 @@ public class DefaultModelBuilder
                         {
                             if ( exclusion.getGroupId() != null && exclusion.getArtifactId() != null )
                             {
-                                for ( final Iterator<Dependency> dependencies = importMngt.getDependencies().iterator();
-                                      dependencies.hasNext(); )
+                                for ( final Iterator<Dependency> dependencies =
+                                    importMngt.getDependencies().iterator(); dependencies.hasNext(); )
                                 {
                                     final Dependency candidate = dependencies.next();
 
                                     if ( ( exclusion.getGroupId().equals( "*" )
-                                           || exclusion.getGroupId().equals( candidate.getGroupId() ) )
-                                             && ( exclusion.getArtifactId().equals( "*" )
-                                                  || exclusion.getArtifactId().equals( candidate.getArtifactId() ) ) )
+                                        || exclusion.getGroupId().equals( candidate.getGroupId() ) )
+                                        && ( exclusion.getArtifactId().equals( "*" )
+                                            || exclusion.getArtifactId().equals( candidate.getArtifactId() ) ) )
                                     {
                                         // Dependency excluded from import.
                                         dependencies.remove();
@@ -1442,7 +1428,7 @@ public class DefaultModelBuilder
                     {
                         // Only dependency managements without exclusion processing applied can be cached.
                         putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.IMPORT,
-                                  importMngt );
+                            importMngt );
 
                     }
                 }
@@ -1467,17 +1453,15 @@ public class DefaultModelBuilder
     {
         try
         {
-            final String imported =
-                String.format( "%s:%s:%s", dependency.getGroupId(), dependency.getArtifactId(),
-                               dependency.getVersion() );
+            final String imported = String.format( "%s:%s:%s", dependency.getGroupId(), dependency.getArtifactId(),
+                dependency.getVersion() );
 
             final Dependency resolvedDependency = dependency.clone();
             final ModelSource importSource =
                 targetModelBuildingRequest.getModelResolver().resolveModel( resolvedDependency );
 
-            final String resolvedId =
-                String.format( "%s:%s:%s", resolvedDependency.getGroupId(), resolvedDependency.getArtifactId(),
-                               resolvedDependency.getVersion() );
+            final String resolvedId = String.format( "%s:%s:%s", resolvedDependency.getGroupId(),
+                resolvedDependency.getArtifactId(), resolvedDependency.getVersion() );
 
             if ( !imported.equals( resolvedId ) && importIds.contains( resolvedId ) )
             {
@@ -1507,29 +1491,29 @@ public class DefaultModelBuilder
                 Model importModel = importResult.getEffectiveModel();
 
                 if ( importModel.getDistributionManagement() != null
-                         && importModel.getDistributionManagement().getRelocation() != null )
+                    && importModel.getDistributionManagement().getRelocation() != null )
                 {
                     final Dependency relocated = dependency.clone();
                     relocated.setGroupId( importModel.getDistributionManagement().getRelocation().getGroupId() );
                     relocated.setArtifactId( importModel.getDistributionManagement().getRelocation().getArtifactId() );
                     relocated.setVersion( importModel.getDistributionManagement().getRelocation().getVersion() );
 
-                    String message = String.format(
-                        "The dependency of type='%s' and scope='%s' has been relocated to '%s:%s:%s'",
-                        dependency.getType(), dependency.getScope(), relocated.getGroupId(),
-                        relocated.getArtifactId(), relocated.getVersion() );
+                    String message =
+                        String.format( "The dependency of type='%s' and scope='%s' has been relocated to '%s:%s:%s'",
+                            dependency.getType(), dependency.getScope(), relocated.getGroupId(),
+                            relocated.getArtifactId(), relocated.getVersion() );
 
                     if ( importModel.getDistributionManagement().getRelocation().getMessage() != null )
                     {
                         message += ". " + importModel.getDistributionManagement().getRelocation().getMessage();
                     }
 
-                    problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE ).
-                        setMessage( message ).
-                        setLocation( importModel.getDistributionManagement().getRelocation().getLocation( "" ) ) );
+                    problems
+                        .add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE ).setMessage( message )
+                            .setLocation( importModel.getDistributionManagement().getRelocation().getLocation( "" ) ) );
 
-                    importModel = this.buildImportModelFromRepository(
-                        targetModelBuildingRequest, relocated, importIds, problems );
+                    importModel = this.buildImportModelFromRepository( targetModelBuildingRequest, relocated, importIds,
+                        problems );
 
                 }
 
@@ -1542,19 +1526,17 @@ public class DefaultModelBuilder
             buffer.append( "Non-resolvable " + dependency.getScope() + " POM" );
 
             if ( !containsCoordinates( e.getMessage(), dependency.getGroupId(), dependency.getArtifactId(),
-                                       dependency.getVersion() ) )
+                dependency.getVersion() ) )
             {
-                buffer.append( ' ' ).append( ModelProblemUtils.toId(
-                    dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion() ) );
+                buffer.append( ' ' ).append( ModelProblemUtils.toId( dependency.getGroupId(),
+                    dependency.getArtifactId(), dependency.getVersion() ) );
 
             }
 
             buffer.append( ": " ).append( e.getMessage() );
 
-            problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).
-                setMessage( buffer.toString() ).
-                setLocation( dependency.getLocation( "" ) ).
-                setException( e ) );
+            problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+                .setMessage( buffer.toString() ).setLocation( dependency.getLocation( "" ) ).setException( e ) );
 
         }
         catch ( final ModelBuildingException e )
@@ -1563,19 +1545,17 @@ public class DefaultModelBuilder
             buffer.append( "Failure building " + dependency.getScope() + " POM" );
 
             if ( !containsCoordinates( e.getMessage(), dependency.getGroupId(), dependency.getArtifactId(),
-                                       dependency.getVersion() ) )
+                dependency.getVersion() ) )
             {
-                buffer.append( ' ' ).append( ModelProblemUtils.toId(
-                    dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion() ) );
+                buffer.append( ' ' ).append( ModelProblemUtils.toId( dependency.getGroupId(),
+                    dependency.getArtifactId(), dependency.getVersion() ) );
 
             }
 
             buffer.append( ": " ).append( e.getMessage() );
 
-            problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).
-                setMessage( buffer.toString() ).
-                setLocation( dependency.getLocation( "" ) ).
-                setException( e ) );
+            problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+                .setMessage( buffer.toString() ).setLocation( dependency.getLocation( "" ) ).setException( e ) );
 
             problems.addAll( e.getProblems() );
         }
@@ -1608,7 +1588,7 @@ public class DefaultModelBuilder
 
     private void fireEvent( Model model, ModelBuildingRequest request, ModelProblemCollector problems,
                             ModelBuildingEventCatapult catapult )
-        throws ModelBuildingException
+                                throws ModelBuildingException
     {
         ModelBuildingListener listener = request.getModelBuildingListener();
 
@@ -1622,10 +1602,9 @@ public class DefaultModelBuilder
 
     private boolean containsCoordinates( String message, String groupId, String artifactId, String version )
     {
-        return message != null
-                   && ( groupId == null || message.contains( groupId ) )
-                   && ( artifactId == null || message.contains( artifactId ) )
-                   && ( version == null || message.contains( version ) );
+        return message != null && ( groupId == null || message.contains( groupId ) )
+            && ( artifactId == null || message.contains( artifactId ) )
+            && ( version == null || message.contains( version ) );
 
     }
 


[19/33] maven git commit: [MNG-6074] Maven should print a warning if no model version has been set in a POM file.

Posted by kh...@apache.org.
[MNG-6074] Maven should print a warning if no model version has been set in a POM file.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/0246aed0
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/0246aed0
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/0246aed0

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 0246aed0c2b29522a323d45bbf455251e8bb049e
Parents: 45a0420
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Jul 30 21:29:12 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sat Jul 30 21:29:12 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/model/validation/DefaultModelValidator.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/0246aed0/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
index efe8895..cdd6c37 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -100,8 +100,9 @@ public class DefaultModelValidator
         if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
         {
             Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
+            Severity errOn31 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
 
-            validateStringNotEmpty( "modelVersion", problems, Severity.WARNING, Version.V20, m.getModelVersion(), m );
+            validateStringNotEmpty( "modelVersion", problems, errOn31, Version.V20, m.getModelVersion(), m );
             validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, m.getModelVersion(), null, m,
                           "4.0.0" );
 


[08/33] maven git commit: updated code to match MessageBuilder API change

Posted by kh...@apache.org.
updated code to match MessageBuilder API change

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/5fb4bc9a
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/5fb4bc9a
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/5fb4bc9a

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 5fb4bc9a237ad2c19c5851b89d0ed810d2eff02d
Parents: 7fa6ce7
Author: Herv� Boutemy <hb...@apache.org>
Authored: Mon Jul 18 00:42:00 2016 +0200
Committer: Herv� Boutemy <hb...@apache.org>
Committed: Mon Jul 18 00:42:00 2016 +0200

----------------------------------------------------------------------
 .../lifecycle/LifecycleExecutionException.java  |  9 +++--
 .../java/org/apache/maven/cli/CLIManager.java   |  8 ++---
 .../java/org/apache/maven/cli/MavenCli.java     | 16 ++++-----
 .../maven/cli/event/ExecutionEventLogger.java   | 37 ++++++++++----------
 .../cli/logging/impl/gossip/ColorRenderer.java  |  8 ++---
 5 files changed, 38 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/5fb4bc9a/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java b/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
index 0578cd1..62ae269 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
@@ -23,7 +23,7 @@ import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
 
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.utils.logging.MessageBuffer;
+import org.apache.maven.shared.utils.logging.MessageBuilder;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -78,16 +78,15 @@ public class LifecycleExecutionException
 
     private static String createMessage( MojoExecution execution, MavenProject project, Throwable cause )
     {
-        MessageBuffer buffer = buffer( 256 );
+        MessageBuilder buffer = buffer( 256 );
 
         buffer.a( "Failed to execute goal" );
 
         if ( execution != null )
         {
             buffer.a( ' ' ).a( execution.getGroupId() ).a( ':' );
-            buffer.mojo().a( execution.getArtifactId() ).a( ':' );
-            buffer.a( execution.getVersion() ).a( ':' ).a( execution.getGoal() ).reset();
-            buffer.strong().a( " (" ).a( execution.getExecutionId() ).a( ')' ).reset();
+            buffer.mojo( execution.getArtifactId() + ':' + execution.getVersion() + ':' + execution.getGoal() );
+            buffer.a( ' ' ).strong( '(' + execution.getExecutionId() + ')' );
         }
 
         if ( project != null )

http://git-wip-us.apache.org/repos/asf/maven/blob/5fb4bc9a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
index f461835..f86f48b 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
@@ -108,7 +108,7 @@ public class CLIManager
     {
         options = new Options();
         options.addOption( OptionBuilder.withLongOpt( "help" ).withDescription( "Display help information" ).create( HELP ) );
-        options.addOption( OptionBuilder.withLongOpt( "file" ).hasArg().withDescription( "Force the use of an alternate POM file (or directory with pom.xml)." ).create( ALTERNATE_POM_FILE ) );
+        options.addOption( OptionBuilder.withLongOpt( "file" ).hasArg().withDescription( "Force the use of an alternate POM file (or directory with pom.xml)" ).create( ALTERNATE_POM_FILE ) );
         options.addOption( OptionBuilder.withLongOpt( "define" ).hasArg().withDescription( "Define a system property" ).create( SET_SYSTEM_PROPERTY ) );
         options.addOption( OptionBuilder.withLongOpt( "offline" ).withDescription( "Work offline" ).create( OFFLINE ) );
         options.addOption( OptionBuilder.withLongOpt( "version" ).withDescription( "Display version information" ).create( VERSION ) );
@@ -118,7 +118,7 @@ public class CLIManager
         options.addOption( OptionBuilder.withLongOpt( "non-recursive" ).withDescription( "Do not recurse into sub-projects" ).create( NON_RECURSIVE ) );
         options.addOption( OptionBuilder.withLongOpt( "update-snapshots" ).withDescription( "Forces a check for missing releases and updated snapshots on remote repositories" ).create( UPDATE_SNAPSHOTS ) );
         options.addOption( OptionBuilder.withLongOpt( "activate-profiles" ).withDescription( "Comma-delimited list of profiles to activate" ).hasArg().create( ACTIVATE_PROFILES ) );
-        options.addOption( OptionBuilder.withLongOpt( "batch-mode" ).withDescription( "Run in non-interactive (batch) mode" ).create( BATCH_MODE ) );
+        options.addOption( OptionBuilder.withLongOpt( "batch-mode" ).withDescription( "Run in non-interactive (batch) mode (disables output color)" ).create( BATCH_MODE ) );
         options.addOption( OptionBuilder.withLongOpt( "no-snapshot-updates" ).withDescription( "Suppress SNAPSHOT updates" ).create( SUPRESS_SNAPSHOT_UPDATES ) );
         options.addOption( OptionBuilder.withLongOpt( "strict-checksums" ).withDescription( "Fail the build if checksums don't match" ).create( CHECKSUM_FAILURE_POLICY ) );
         options.addOption( OptionBuilder.withLongOpt( "lax-checksums" ).withDescription( "Warn if checksums don't match" ).create( CHECKSUM_WARNING_POLICY ) );
@@ -133,13 +133,13 @@ public class CLIManager
         options.addOption( OptionBuilder.withLongOpt( "projects" ).withDescription( "Comma-delimited list of specified reactor projects to build instead of all projects. A project can be specified by [groupId]:artifactId or by its relative path." ).hasArg().create( PROJECT_LIST ) );
         options.addOption( OptionBuilder.withLongOpt( "also-make" ).withDescription( "If project list is specified, also build projects required by the list" ).create( ALSO_MAKE ) );
         options.addOption( OptionBuilder.withLongOpt( "also-make-dependents" ).withDescription( "If project list is specified, also build projects that depend on projects on the list" ).create( ALSO_MAKE_DEPENDENTS ) );
-        options.addOption( OptionBuilder.withLongOpt( "log-file" ).hasArg().withDescription( "Log file where all build output will go." ).create( LOG_FILE ) );
+        options.addOption( OptionBuilder.withLongOpt( "log-file" ).hasArg().withDescription( "Log file where all build output will go" ).create( LOG_FILE ) );
         options.addOption( OptionBuilder.withLongOpt( "show-version" ).withDescription( "Display version information WITHOUT stopping build" ).create( SHOW_VERSION ) );
         options.addOption( OptionBuilder.withLongOpt( "encrypt-master-password" ).hasOptionalArg().withDescription( "Encrypt master security password" ).create( ENCRYPT_MASTER_PASSWORD ) );
         options.addOption( OptionBuilder.withLongOpt( "encrypt-password" ).hasOptionalArg().withDescription( "Encrypt server password" ).create( ENCRYPT_PASSWORD ) );
         options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) );
         options.addOption( OptionBuilder.withLongOpt( "legacy-local-repository" ).withDescription( "Use Maven 2 Legacy Local Repository behaviour, ie no use of _remote.repositories. Can also be activated by using -Dmaven.legacyLocalRepo=true" ).create( LEGACY_LOCAL_REPOSITORY ) );
-        options.addOption( OptionBuilder.withLongOpt( "builder" ).hasArg().withDescription( "The id of the build strategy to use." ).create( BUILDER ) );
+        options.addOption( OptionBuilder.withLongOpt( "builder" ).hasArg().withDescription( "The id of the build strategy to use" ).create( BUILDER ) );
 
         // Adding this back in for compatibility with the verifier that hard codes this option.
         options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) );

http://git-wip-us.apache.org/repos/asf/maven/blob/5fb4bc9a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index b0cd1cd..6b482aa 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -91,7 +91,7 @@ import org.apache.maven.model.profile.ProfileSelector;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.properties.internal.EnvironmentUtils;
 import org.apache.maven.properties.internal.SystemProperties;
-import org.apache.maven.shared.utils.logging.MessageBuffer;
+import org.apache.maven.shared.utils.logging.MessageBuilder;
 import org.apache.maven.shared.utils.logging.MessageUtils;
 import org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest;
 import org.apache.maven.toolchain.building.ToolchainsBuilder;
@@ -536,12 +536,12 @@ public class MavenCli
             slf4jLogger.debug( "Message scheme: " + ( MessageUtils.isColorEnabled() ? "color" : "plain" ) );
             if ( MessageUtils.isColorEnabled() )
             {
-                MessageBuffer buff = MessageUtils.buffer();
+                MessageBuilder buff = MessageUtils.buffer();
                 buff.a( "Message styles: " );
-                buff.debug().a( "debug" ).reset().a( ' ' );
-                buff.info().a( "info" ).reset().a( ' ' );
-                buff.warning().a( "warning" ).reset().a( ' ' );
-                buff.error().a( "error" ).reset().a( ' ' );
+                buff.debug( "debug" ).a( ' ' );
+                buff.info( "info" ).a( ' ' );
+                buff.warning( "warning" ).a( ' ' );
+                buff.error( "error" ).a( ' ' );
                 buff.success( "success" ).a( ' ' );
                 buff.failure( "failure" ).a( ' ' );
                 buff.strong( "strong" ).a( ' ' );
@@ -1065,8 +1065,8 @@ public class MavenCli
             {
                 slf4jLogger.error( "" );
                 slf4jLogger.error( "After correcting the problems, you can resume the build with the command" );
-                slf4jLogger.error( buffer().strong().a( "  mvn <goals> -rf :" )
-                                   .a( project.getArtifactId() ).reset().toString() );
+                slf4jLogger.error( buffer().a( "  " ).strong( "mvn <goals> -rf :"
+                    + project.getArtifactId() ).toString() );
             }
 
             if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( cliRequest.request.getReactorFailureBehavior() ) )

http://git-wip-us.apache.org/repos/asf/maven/blob/5fb4bc9a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
index 2c2e4c2..2f4cfd8 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
@@ -34,7 +34,7 @@ import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.utils.logging.MessageBuffer;
+import org.apache.maven.shared.utils.logging.MessageBuilder;
 import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -197,7 +197,7 @@ public class ExecutionEventLogger
     private void logResult( MavenSession session )
     {
         infoLine( '-' );
-        MessageBuffer buffer = buffer();
+        MessageBuilder buffer = buffer();
 
         if ( session.getResult().hasExceptions() )
         {
@@ -282,7 +282,7 @@ public class ExecutionEventLogger
         {
             logger.info( "" );
 
-            MessageBuffer buffer = buffer().strong( "--- " );
+            MessageBuilder buffer = buffer().strong( "--- " );
             append( buffer, event.getMojoExecution() );
             append( buffer, event.getProject() );
             buffer.strong( " ---" );
@@ -302,7 +302,7 @@ public class ExecutionEventLogger
         {
             logger.info( "" );
 
-            MessageBuffer buffer = buffer().strong( ">>> " );
+            MessageBuilder buffer = buffer().strong( ">>> " );
             append( buffer, event.getMojoExecution() );
             buffer.strong( " > " );
             appendForkInfo( buffer, event.getMojoExecution().getMojoDescriptor() );
@@ -326,7 +326,7 @@ public class ExecutionEventLogger
         {
             logger.info( "" );
 
-            MessageBuffer buffer = buffer().strong( "<<< " );
+            MessageBuilder buffer = buffer().strong( "<<< " );
             append( buffer, event.getMojoExecution() );
             buffer.strong( " < " );
             appendForkInfo( buffer, event.getMojoExecution().getMojoDescriptor() );
@@ -337,40 +337,39 @@ public class ExecutionEventLogger
         }
     }
 
-    private void append( MessageBuffer buffer, MojoExecution me )
+    private void append( MessageBuilder buffer, MojoExecution me )
     {
-        buffer.mojo().a( me.getArtifactId() ).a( ':' ).a( me.getVersion() );
-        buffer.a( ':' ).a( me.getGoal() ).reset();
+        buffer.mojo( me.getArtifactId() + ':' + me.getVersion() + ':' + me.getGoal() );
         if ( me.getExecutionId() != null )
         {
-            buffer.strong().a( " (" ).a( me.getExecutionId() ).a( ')' ).reset();
+            buffer.a( ' ' ).strong( '(' + me.getExecutionId() + ')' );
         }
     }
 
-    private void appendForkInfo( MessageBuffer buffer, MojoDescriptor md )
+    private void appendForkInfo( MessageBuilder buffer, MojoDescriptor md )
     {
-        buffer.strong();
+        StringBuilder buff = new StringBuilder();
         if ( StringUtils.isNotEmpty( md.getExecutePhase() ) )
         {
             // forked phase
             if ( StringUtils.isNotEmpty( md.getExecuteLifecycle() ) )
             {
-                buffer.a( '[' );
-                buffer.a( md.getExecuteLifecycle() );
-                buffer.a( ']' );
+                buff.append( '[' );
+                buff.append( md.getExecuteLifecycle() );
+                buff.append( ']' );
             }
-            buffer.a( md.getExecutePhase() );
+            buff.append( md.getExecutePhase() );
         }
         else
         {
             // forked goal
-            buffer.a( ':' );
-            buffer.a( md.getExecuteGoal() );
+            buff.append( ':' );
+            buff.append( md.getExecuteGoal() );
         }
-        buffer.reset();
+        buffer.strong( buff.toString() );
     }
 
-    private void append( MessageBuffer buffer, MavenProject project )
+    private void append( MessageBuilder buffer, MavenProject project )
     {
         buffer.a( " @ " ).project( project.getArtifactId() );
     }

http://git-wip-us.apache.org/repos/asf/maven/blob/5fb4bc9a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java
index a21d89d..18fd08b 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java
@@ -46,20 +46,20 @@ extends com.planet57.gossip.render.PatternRenderer
         {
             case TRACE:
             case DEBUG:
-                buff.append( buffer().debug().a( level.name() ).reset() );
+                buff.append( buffer().debug( level.name() ) );
                 break;
 
             case INFO:
-                buff.append( buffer().info().a( level.name() ).reset() );
+                buff.append( buffer().info( level.name() ) );
                 break;
 
             case WARN:
                 // Maven uses WARNING instead of WARN
-                buff.append( buffer().warning().a( WARNING ).reset() );
+                buff.append( buffer().warning( WARNING ) );
                 break;
 
             case ERROR:
-                buff.append( buffer().error().a( level.name() ).reset() );
+                buff.append( buffer().error( level.name() ) );
                 break;
 
             default:


[10/33] maven git commit: [MNG-4645] Move central repo definition out of Maven's core so it can be more easily changed [MNG-6070] [REGRESSION] Profile activation based on a property does not work correctly

Posted by kh...@apache.org.
[MNG-4645] Move central repo definition out of Maven's core so it can be more easily changed
[MNG-6070] [REGRESSION] Profile activation based on a property does not work correctly


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/6d9ffe35
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/6d9ffe35
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/6d9ffe35

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 6d9ffe351814f5482def88066ce9dd2011567689
Parents: 90f26c2
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Jul 23 20:15:18 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sat Jul 23 20:15:18 2016 +0200

----------------------------------------------------------------------
 apache-maven/src/conf/settings.xml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/6d9ffe35/apache-maven/src/conf/settings.xml
----------------------------------------------------------------------
diff --git a/apache-maven/src/conf/settings.xml b/apache-maven/src/conf/settings.xml
index 8d903f2..3fa2f14 100644
--- a/apache-maven/src/conf/settings.xml
+++ b/apache-maven/src/conf/settings.xml
@@ -249,7 +249,11 @@ under the License.
     | Default profile holding various defaults.
     |-->
     <profile>
-      <id>default</id>
+      <!--
+      This intentionally uses a UUID to not clash with any profile
+      id already in use before this profile got added to the settings.
+      -->
+      <id>f06abaa7-178e-441e-bb0d-10a92d7ce014</id>
 
       <repositories>
         <repository>
@@ -291,7 +295,7 @@ under the License.
     <activeProfile>alwaysActiveProfile</activeProfile>
     <activeProfile>anotherAlwaysActiveProfile</activeProfile>
     -->
-    <activeProfile>default</activeProfile>
+    <activeProfile>f06abaa7-178e-441e-bb0d-10a92d7ce014</activeProfile>
   </activeProfiles>
 
 </settings>


[23/33] maven git commit: [MNG-6074] Maven should produce an error if no model version has been set in a POM file used to build an effective model.

Posted by kh...@apache.org.
[MNG-6074] Maven should produce an error if no model version has been set in a POM file used to build an effective model.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/744b98e8
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/744b98e8
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/744b98e8

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 744b98e8cf9f2fbe4f73b07927a2c697e8cc6fc2
Parents: 3681fd8
Author: Christian Schulte <sc...@apache.org>
Authored: Sun Jul 31 18:49:17 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sun Jul 31 18:49:17 2016 +0200

----------------------------------------------------------------------
 .../maven/model/validation/DefaultModelValidator.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/744b98e8/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
index cdd6c37..5f4f577 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -100,9 +100,15 @@ public class DefaultModelValidator
         if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
         {
             Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
-            Severity errOn31 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
 
-            validateStringNotEmpty( "modelVersion", problems, errOn31, Version.V20, m.getModelVersion(), m );
+            // [MNG-6074] Maven should produce an error if no model version has been set in a POM file used to build an
+            //            effective model.
+            //
+            // As of 3.4, the model version is mandatory even in raw models. The XML element still is optional in the
+            // XML schema and this will not change anytime soon. We do not want to build effective models based on
+            // models without a version starting with 3.4.
+            validateStringNotEmpty( "modelVersion", problems, Severity.ERROR, Version.V20, m.getModelVersion(), m );
+
             validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, m.getModelVersion(), null, m,
                           "4.0.0" );
 


[26/33] maven git commit: [MNG-6075] Increase the model validation level to the next minor level version.

Posted by kh...@apache.org.
[MNG-6075] Increase the model validation level to the next minor level version.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/a5e87a42
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/a5e87a42
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/a5e87a42

Branch: refs/heads/MNG-6056-feature-toggle
Commit: a5e87a42376cc6ecd086bb3dd79ff713ace3d6de
Parents: 615390d
Author: Christian Schulte <sc...@apache.org>
Authored: Mon Aug 1 10:06:14 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Mon Aug 1 10:06:14 2016 +0200

----------------------------------------------------------------------
 .../org/apache/maven/model/building/DefaultModelBuilder.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/a5e87a42/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 2d50ed1..93c62d0 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -784,7 +784,9 @@ public class DefaultModelBuilder
 
                 if ( model.getModelVersion() != null )
                 {
-                    if ( !modelVersions.isEmpty() && modelVersions.add( model.getModelVersion() ) )
+                    final boolean initial = modelVersions.isEmpty();
+
+                    if ( modelVersions.add( model.getModelVersion() ) && !initial )
                     {
                         problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.V31 )
                             .setMessage( String.format(


[16/33] maven git commit: [MNG-6073] Addition of a core extension point to the model builder supporting model finalization. [MNG-3825] Dependencies with classifier should not always require a version.

Posted by kh...@apache.org.
[MNG-6073] Addition of a core extension point to the model builder supporting model finalization.
[MNG-3825] Dependencies with classifier should not always require a version.

o Updated to add a missing '@since' tag.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/7181e5b9
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/7181e5b9
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/7181e5b9

Branch: refs/heads/MNG-6056-feature-toggle
Commit: 7181e5b9f2d3beb9e01706b5b8951044ca19d225
Parents: 17f6838
Author: Christian Schulte <sc...@apache.org>
Authored: Sat Jul 30 20:21:09 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Sat Jul 30 20:21:09 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/maven/model/building/DefaultModelBuilder.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/7181e5b9/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 415808b..2fdc4ee 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -239,6 +239,9 @@ public class DefaultModelBuilder
         return this;
     }
 
+    /**
+     * @since 3.4
+     */
     public DefaultModelBuilder setReportingConverter( ReportingConverter reportingConverter )
     {
         this.reportingConverter = reportingConverter;


[32/33] maven git commit: Safe state.

Posted by kh...@apache.org.
Safe state.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/fd0a6b34
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/fd0a6b34
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/fd0a6b34

Branch: refs/heads/MNG-6056-feature-toggle
Commit: fd0a6b34bd529e0b1df0d211b7fb964b7cae4427
Parents: c4e94a2
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Sat Aug 13 20:41:22 2016 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Sat Aug 13 20:41:22 2016 +0200

----------------------------------------------------------------------
 maven-feature/pom.xml                           |  6 +++
 .../maven/feature/DefaultFeatureToggles.java    |  2 +-
 .../org/apache/maven/feature/FeatureKnob.java   | 45 ++++++++++++++++++++
 .../apache/maven/feature/FeatureKnobTest.java   | 33 ++++++++++++++
 4 files changed, 85 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/fd0a6b34/maven-feature/pom.xml
----------------------------------------------------------------------
diff --git a/maven-feature/pom.xml b/maven-feature/pom.xml
index 0ddd5fc..f631bb9 100644
--- a/maven-feature/pom.xml
+++ b/maven-feature/pom.xml
@@ -49,6 +49,12 @@
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <version>1.7.1</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

http://git-wip-us.apache.org/repos/asf/maven/blob/fd0a6b34/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java b/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
index a47dc8c..c969449 100644
--- a/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
+++ b/maven-feature/src/main/java/org/apache/maven/feature/DefaultFeatureToggles.java
@@ -52,7 +52,7 @@ public class DefaultFeatureToggles
         {
             this.activatedFeatureToggles = new ArrayList<>();
             List<ActivatedFeatureToggles> asList = Arrays.asList( ActivatedFeatureToggles.getActivatedFeatureToggles());
-            this.activatedFeatureToggles.addAll( asList );
+//            this.activatedFeatureToggles.addAll( asList );
         }
         else
         {

http://git-wip-us.apache.org/repos/asf/maven/blob/fd0a6b34/maven-feature/src/test/java/org/apache/maven/feature/FeatureKnob.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/test/java/org/apache/maven/feature/FeatureKnob.java b/maven-feature/src/test/java/org/apache/maven/feature/FeatureKnob.java
new file mode 100644
index 0000000..39a76bf
--- /dev/null
+++ b/maven-feature/src/test/java/org/apache/maven/feature/FeatureKnob.java
@@ -0,0 +1,45 @@
+package org.apache.maven.feature;
+
+import org.apache.commons.lang3.StringUtils;
+
+public class FeatureKnob
+{
+
+    public enum FeatureKnobNames
+    {
+        FIRST,
+        SECOND
+    }
+    
+    public static class FeatureNobFirst {
+        public enum FeatureNobValues {
+            First,
+            Second,
+            Third
+        }
+    }
+
+    boolean doesFeatureKnobExist( FeatureKnobNames name )
+    {
+        String property = System.getProperty( name.toString() );
+        if ( StringUtils.isEmpty( property ) )
+        {
+            return false;
+        }
+        else
+        {
+            return true;
+        }
+    }
+
+    public String getFeatureKnob( FeatureKnobNames first )
+    {
+        if (doesFeatureKnobExist( first )) {
+            return StringUtils.EMPTY;
+        } else 
+        {
+            //Good Idea?
+            return StringUtils.EMPTY;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven/blob/fd0a6b34/maven-feature/src/test/java/org/apache/maven/feature/FeatureKnobTest.java
----------------------------------------------------------------------
diff --git a/maven-feature/src/test/java/org/apache/maven/feature/FeatureKnobTest.java b/maven-feature/src/test/java/org/apache/maven/feature/FeatureKnobTest.java
new file mode 100644
index 0000000..4ad4879
--- /dev/null
+++ b/maven-feature/src/test/java/org/apache/maven/feature/FeatureKnobTest.java
@@ -0,0 +1,33 @@
+package org.apache.maven.feature;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.maven.feature.FeatureKnob.FeatureKnobNames;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>
+ * @since 3.4.0
+ */
+public class FeatureKnobTest
+{
+
+    private FeatureKnob fn;
+
+    @Before
+    public void before()
+    {
+        fn = new FeatureKnob();
+    }
+
+    @Test
+    public void getActiveFeaturesShouldNotReturnNotNullAndSizeOfListZero()
+    {
+        // mvn -DfeatureKnob1=behaviour1
+        // mvn .. => featureKnob1=defaultBehaviour
+        //
+        assertThat( fn.getFeatureKnob( FeatureKnobNames.FIRST ) ).isEqualTo( "XX" );
+    }
+
+}