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:13:53 UTC

[32/40] maven git commit: [MNG-6082] Introduction of model version 4.1.0.

[MNG-6082] Introduction of model version 4.1.0.


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

Branch: refs/heads/MNG-6012-Missing-Profile-At-End
Commit: a1da7315585d32b3d939549ee2ca550f580ce894
Parents: 2e6fe1b
Author: Christian Schulte <sc...@apache.org>
Authored: Thu Aug 18 06:22:28 2016 +0200
Committer: Christian Schulte <sc...@apache.org>
Committed: Thu Aug 18 22:03:13 2016 +0200

----------------------------------------------------------------------
 .../model/building/DefaultModelBuilder.java     | 118 ++++++++++-------
 .../model/superpom/DefaultSuperPomProvider.java |  60 +++++----
 .../model/validation/DefaultModelValidator.java |   3 +-
 .../maven/model/versioning/ModelVersions.java   | 132 +++++++++++++++++++
 .../org/apache/maven/model/pom-4.0.0.xml        |  59 +++++++--
 .../org/apache/maven/model/pom-4.1.0.xml        | 109 +++++++++++++++
 6 files changed, 402 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/a1da7315/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 ecd0a9a..9088984 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,7 @@ import org.apache.maven.model.resolution.UnresolvableModelException;
 import org.apache.maven.model.resolution.WorkspaceModelResolver;
 import org.apache.maven.model.superpom.SuperPomProvider;
 import org.apache.maven.model.validation.ModelValidator;
+import org.apache.maven.model.versioning.ModelVersions;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.interpolation.MapBasedValueSource;
@@ -294,7 +295,7 @@ public class DefaultModelBuilder
         problems.setRootModel( inputModel );
 
         ModelData resultData = new ModelData( request.getModelSource(), inputModel );
-        ModelData superData = new ModelData( null, getSuperModel() );
+        ModelData superData = new ModelData( null, getSuperModel( inputModel.getModelVersion() ) );
 
         Collection<String> parentIds = new LinkedHashSet<>();
         List<ModelData> lineage = new ArrayList<>();
@@ -466,8 +467,12 @@ public class DefaultModelBuilder
             lineage.add( result.getEffectiveModel( modelId ) );
         }
 
-        // [MNG-5971] Imported dependencies should be available to inheritance processing
-        processImports( lineage, request, problems );
+        if ( ModelVersions.supportsDependencyManagementImportInheritanceProcessing( resultModel ) )
+        {
+            // [MNG-5971] Imported dependencies should be available to inheritance processing
+            processImports( lineage, request, problems );
+        }
+
         problems.setSource( resultModel );
 
         // inheritance assembly
@@ -500,6 +505,11 @@ public class DefaultModelBuilder
             lifecycleBindingsInjector.injectLifecycleBindings( resultModel, request, problems );
         }
 
+        if ( !ModelVersions.supportsDependencyManagementImportInheritanceProcessing( resultModel ) )
+        {
+            this.importDependencyManagement( resultModel, "import", request, problems, new HashSet<String>() );
+        }
+
         // dependency management injection
         dependencyManagementInjector.injectManagement( resultModel, request, problems );
 
@@ -1324,9 +1334,9 @@ public class DefaultModelBuilder
         return parentData;
     }
 
-    private Model getSuperModel()
+    private Model getSuperModel( final String version )
     {
-        return superPomProvider.getSuperModel( "4.0.0" ).clone();
+        return superPomProvider.getSuperModel( version ).clone();
     }
 
     private void importDependencyManagement( Model model, String scope, ModelBuildingRequest request,
@@ -1440,7 +1450,8 @@ public class DefaultModelBuilder
                     if ( importModel == null )
                     {
                         // no workspace resolver or workspace resolver returned null (i.e. model not in workspace)
-                        importModel = this.buildImportModelFromRepository( request, dependency, importIds, problems );
+                        importModel = this.buildImportModelFromRepository( model, request, dependency, importIds,
+                                                                           problems );
 
                         if ( importModel == null )
                         {
@@ -1451,41 +1462,44 @@ public class DefaultModelBuilder
                     importMngt = importModel.getDependencyManagement() != null
                                     ? importModel.getDependencyManagement().clone() : new DependencyManagement();
 
-                    // [MNG-5600] Dependency management import should support exclusions.
-                    if ( !dependency.getExclusions().isEmpty() )
+                    if ( ModelVersions.supportsDependencyManagementImportExclusions( model ) )
                     {
-                        for ( final Exclusion exclusion : dependency.getExclusions() )
+                        if ( !dependency.getExclusions().isEmpty() )
                         {
-                            if ( exclusion.getGroupId() != null && exclusion.getArtifactId() != null )
+                            for ( final Exclusion exclusion : dependency.getExclusions() )
                             {
-                                for ( final Iterator<Dependency> dependencies =
-                                    importMngt.getDependencies().iterator(); dependencies.hasNext(); )
+                                if ( exclusion.getGroupId() != null && exclusion.getArtifactId() != null )
                                 {
-                                    final Dependency candidate = dependencies.next();
-
-                                    if ( ( exclusion.getGroupId().equals( "*" )
-                                        || exclusion.getGroupId().equals( candidate.getGroupId() ) )
-                                        && ( exclusion.getArtifactId().equals( "*" )
-                                            || exclusion.getArtifactId().equals( candidate.getArtifactId() ) ) )
+                                    for ( final Iterator<Dependency> dependencies =
+                                        importMngt.getDependencies().iterator(); dependencies.hasNext(); )
                                     {
-                                        // Dependency excluded from import.
-                                        dependencies.remove();
+                                        final Dependency candidate = dependencies.next();
+
+                                        if ( ( exclusion.getGroupId().equals( "*" )
+                                               || exclusion.getGroupId().equals( candidate.getGroupId() ) )
+                                                 && ( exclusion.getArtifactId().equals( "*" )
+                                                      || exclusion.getArtifactId().
+                                                     equals( candidate.getArtifactId() ) ) )
+                                        {
+                                            // Dependency excluded from import.
+                                            dependencies.remove();
+                                        }
                                     }
                                 }
                             }
-                        }
 
-                        for ( final Dependency includedDependency : importMngt.getDependencies() )
-                        {
-                            includedDependency.getExclusions().addAll( dependency.getExclusions() );
+                            for ( final Dependency includedDependency : importMngt.getDependencies() )
+                            {
+                                includedDependency.getExclusions().addAll( dependency.getExclusions() );
+                            }
                         }
-                    }
-                    else
-                    {
-                        // Only dependency managements without exclusion processing applied can be cached.
-                        putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.IMPORT,
-                            importMngt );
+                        else
+                        {
+                            // Only dependency managements without exclusion processing applied can be cached.
+                            putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.IMPORT,
+                                      importMngt );
 
+                        }
                     }
                 }
 
@@ -1503,21 +1517,28 @@ public class DefaultModelBuilder
         }
     }
 
-    private Model buildImportModelFromRepository( final ModelBuildingRequest targetModelBuildingRequest,
+    private Model buildImportModelFromRepository( final Model model,
+                                                  final ModelBuildingRequest targetModelBuildingRequest,
                                                   final Dependency dependency, final Collection<String> importIds,
                                                   final DefaultModelProblemCollector problems )
     {
         try
         {
             final String imported = String.format( "%s:%s:%s", dependency.getGroupId(), dependency.getArtifactId(),
-                dependency.getVersion() );
+                                                   dependency.getVersion() );
 
             final Dependency resolvedDependency = dependency.clone();
+
             final ModelSource importSource =
-                targetModelBuildingRequest.getModelResolver().resolveModel( resolvedDependency );
+                ModelVersions.supportsDependencyManagementImportVersionRanges( model )
+                    ? targetModelBuildingRequest.getModelResolver().resolveModel( resolvedDependency )
+                    : targetModelBuildingRequest.getModelResolver().resolveModel(
+                        resolvedDependency.getGroupId(), resolvedDependency.getArtifactId(),
+                        resolvedDependency.getVersion() );
 
-            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 ) )
             {
@@ -1547,7 +1568,8 @@ public class DefaultModelBuilder
                 Model importModel = importResult.getEffectiveModel();
 
                 if ( importModel.getDistributionManagement() != null
-                    && importModel.getDistributionManagement().getRelocation() != null )
+                         && importModel.getDistributionManagement().getRelocation() != null
+                         && ModelVersions.supportsDependencyManagementImportRelocations( model ) )
                 {
                     final Dependency relocated = dependency.clone();
                     relocated.setGroupId( importModel.getDistributionManagement().getRelocation().getGroupId() );
@@ -1556,20 +1578,20 @@ public class DefaultModelBuilder
 
                     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() );
+                                       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( model, targetModelBuildingRequest, relocated,
+                                                                       importIds, problems );
 
                 }
 
@@ -1582,10 +1604,11 @@ 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() ) );
+                                                                     dependency.getArtifactId(),
+                                                                     dependency.getVersion() ) );
 
             }
 
@@ -1601,10 +1624,11 @@ 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() ) );
+                                                                     dependency.getArtifactId(),
+                                                                     dependency.getVersion() ) );
 
             }
 

http://git-wip-us.apache.org/repos/asf/maven/blob/a1da7315/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java b/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
index 322dcae..2338c62 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
@@ -21,11 +21,14 @@ package org.apache.maven.model.superpom;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.maven.model.Model;
 import org.apache.maven.model.building.ModelProcessor;
+import org.apache.maven.model.versioning.ModelVersions;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 
@@ -40,9 +43,10 @@ public class DefaultSuperPomProvider
 {
 
     /**
-     * The cached super POM, lazily created.
+     * Cached super POMs, lazily created.
      */
-    private Model superModel;
+    private volatile Reference<Map<String, Model>> modelCache =
+        new SoftReference<Map<String, Model>>( new HashMap<String, Model>() );
 
     @Requirement
     private ModelProcessor modelProcessor;
@@ -54,34 +58,46 @@ public class DefaultSuperPomProvider
     }
 
     @Override
-    public Model getSuperModel( String version )
+    public Model getSuperModel( final String version )
     {
-        if ( superModel == null )
-        {
-            String resource = "/org/apache/maven/model/pom-" + version + ".xml";
-
-            InputStream is = getClass().getResourceAsStream( resource );
+        // [MNG-666] need to be able to operate on a Maven 1 repository
+        //    Instead of throwing an exception if version == null, we return a version "4.0.0" super pom.
+        final String effectiveVersion = version == null ? ModelVersions.V4_0_0 : version;
+        final String resource = "/org/apache/maven/model/pom-" + effectiveVersion + ".xml";
 
-            if ( is == null )
+        try
+        {
+            Map<String, Model> superPoms = this.modelCache.get();
+            if ( superPoms == null )
             {
-                throw new IllegalStateException( "The super POM " + resource + " was not found"
-                    + ", please verify the integrity of your Maven installation" );
+                superPoms = new HashMap<>();
+                this.modelCache = new SoftReference<>( superPoms );
             }
 
-            try
-            {
-                Map<String, String> options = new HashMap<>();
-                options.put( "xml:4.0.0", "xml:4.0.0" );
-                superModel = modelProcessor.read( is, options );
-            }
-            catch ( IOException e )
+            Model superModel = superPoms.get( effectiveVersion );
+
+            if ( superModel == null )
             {
-                throw new IllegalStateException( "The super POM " + resource + " is damaged"
-                    + ", please verify the integrity of your Maven installation", e );
+                InputStream is = getClass().getResourceAsStream( resource );
+
+                if ( is == null )
+                {
+                    throw new IllegalStateException( "The super POM " + resource + " was not found"
+                                                         + ", please verify the integrity of your Maven installation" );
+
+                }
+
+                superModel = modelProcessor.read( is, null );
+                superPoms.put( effectiveVersion, superModel );
             }
-        }
 
-        return superModel;
+            return superModel;
+        }
+        catch ( IOException e )
+        {
+            throw new IllegalStateException( "The super POM " + resource + " is damaged"
+                                                 + ", please verify the integrity of your Maven installation", e );
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/maven/blob/a1da7315/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 5f4f577..89bd94b 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
@@ -53,6 +53,7 @@ import org.apache.maven.model.building.ModelProblem.Severity;
 import org.apache.maven.model.building.ModelProblem.Version;
 import org.apache.maven.model.building.ModelProblemCollector;
 import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.apache.maven.model.versioning.ModelVersions;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -110,7 +111,7 @@ public class DefaultModelValidator
             validateStringNotEmpty( "modelVersion", problems, Severity.ERROR, Version.V20, m.getModelVersion(), m );
 
             validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, m.getModelVersion(), null, m,
-                          "4.0.0" );
+                          ModelVersions.V4_0_0, ModelVersions.V4_1_0 );
 
             validateStringNoExpression( "groupId", problems, Severity.WARNING, Version.V20, m.getGroupId(), m );
             if ( parent == null )

http://git-wip-us.apache.org/repos/asf/maven/blob/a1da7315/maven-model-builder/src/main/java/org/apache/maven/model/versioning/ModelVersions.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/versioning/ModelVersions.java b/maven-model-builder/src/main/java/org/apache/maven/model/versioning/ModelVersions.java
new file mode 100644
index 0000000..6b527ca
--- /dev/null
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/versioning/ModelVersions.java
@@ -0,0 +1,132 @@
+package org.apache.maven.model.versioning;
+
+/*
+ * 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.Objects;
+
+import org.apache.maven.model.Model;
+
+/**
+ * Gathers model version information.
+ *
+ * @author Christian Schulte
+ * @since 3.4
+ */
+public final class ModelVersions
+{
+
+    /**
+     * Creates a new {@code ModelVersions} instance.
+     */
+    private ModelVersions()
+    {
+        super();
+    }
+
+    /**
+     * Constant for model version {@code 4.0.0}.
+     */
+    public static final String V4_0_0 = "4.0.0";
+
+    /**
+     * Constant for model version {@code 4.1.0}.
+     */
+    public static final String V4_1_0 = "4.1.0";
+
+    /**
+     * Tests whether dependency management import version ranges are supported for a given {@code Model}.
+     *
+     * @param model The {@code Model} to test.
+     *
+     * @return {@code true}, if dependency management import version ranges are supported for {@code model};
+     * {@code false}, if dependency management import version ranges are not supported for {@code model}.
+     */
+    public static boolean supportsDependencyManagementImportVersionRanges( final Model model )
+    {
+        // [MNG-4463] Version ranges cannot be used for artifacts with 'import' scope
+        return isGreaterOrEqual( model, V4_1_0 );
+    }
+
+    /**
+     * Tests whether dependency management import exclusions are supported for a given {@code Model}.
+     *
+     * @param model The {@code Model} to test.
+     *
+     * @return {@code true}, if dependency management import exclusions are supported for {@code model};
+     * {@code false}, if dependency management import exclusions are not supported for {@code model}.
+     */
+    public static boolean supportsDependencyManagementImportExclusions( final Model model )
+    {
+        // [MNG-5600] Dependency management import should support exclusions.
+        return isGreaterOrEqual( model, V4_1_0 );
+    }
+
+    /**
+     * Tests whether dependency management import relocations are supported for a given {@code Model}.
+     *
+     * @param model The {@code Model} to test.
+     *
+     * @return {@code true}, if dependency management import relocations are supported for {@code model};
+     * {@code false}, if dependency management import relocations are not supported for {@code model}.
+     */
+    public static boolean supportsDependencyManagementImportRelocations( final Model model )
+    {
+        // [MNG-5527] Dependency management import should support relocations.
+        return isGreaterOrEqual( model, V4_1_0 );
+    }
+
+    /**
+     * Tests whether dependency management import inheritance processing is supported for a given {@code Model}.
+     *
+     * @param model The {@code Model} to test.
+     *
+     * @return {@code true}, if dependency management import inheritance processing is supported for {@code model};
+     * {@code false}, if dependency management import inheritance processing is not supported for {@code model}.
+     */
+    public static boolean supportsDependencyManagementImportInheritanceProcessing( final Model model )
+    {
+        // [MNG-5971] Imported dependencies should be available to inheritance processing
+        return isGreaterOrEqual( model, V4_1_0 );
+    }
+
+    private static boolean isGreaterOrEqual( final Model model, final String version )
+    {
+        Objects.requireNonNull( model, "model" );
+        Objects.requireNonNull( version, "version" );
+
+        if ( null != model.getModelVersion() )
+        {
+            switch ( model.getModelVersion() )
+            {
+                case V4_0_0:
+                    return V4_0_0.equals( version );
+                case V4_1_0:
+                    return V4_0_0.equals( version ) || V4_1_0.equals( version );
+                default:
+                    throw new AssertionError( String.format( "Unsupported model version '%s'.", version ) );
+            }
+        }
+
+        // [MNG-666] need to be able to operate on a Maven 1 repository
+        //   Handles null as the lowest version possible.
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven/blob/a1da7315/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml
index 7565dfb..91492a9 100644
--- a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml
+++ b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml
@@ -23,6 +23,33 @@ under the License.
 <project>
   <modelVersion>4.0.0</modelVersion>
 
+  <repositories>
+    <repository>
+      <id>central</id>
+      <name>Central Repository</name>
+      <url>https://repo.maven.apache.org/maven2</url>
+      <layout>default</layout>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>central</id>
+      <name>Central Repository</name>
+      <url>https://repo.maven.apache.org/maven2</url>
+      <layout>default</layout>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+        <updatePolicy>never</updatePolicy>
+      </releases>
+    </pluginRepository>
+  </pluginRepositories>
+
   <build>
     <directory>${project.basedir}/target</directory>
     <outputDirectory>${project.build.directory}/classes</outputDirectory>
@@ -35,20 +62,34 @@ under the License.
       <resource>
         <directory>${project.basedir}/src/main/resources</directory>
       </resource>
-      <resource>
-        <directory>${project.basedir}/src/main/resources-filtered</directory>
-        <filtering>true</filtering>
-      </resource>
     </resources>
     <testResources>
       <testResource>
         <directory>${project.basedir}/src/test/resources</directory>
       </testResource>
-      <testResource>
-        <directory>${project.basedir}/src/test/resources-filtered</directory>
-        <filtering>true</filtering>
-      </testResource>
     </testResources>
+    <pluginManagement>
+      <!-- NOTE: These plugins will be removed from future versions of the super POM -->
+      <!-- They are kept for the moment as they are very unlikely to conflict with lifecycle mappings (MNG-4453) -->
+      <plugins>
+        <plugin>
+          <artifactId>maven-antrun-plugin</artifactId>
+          <version>1.3</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-assembly-plugin</artifactId>
+          <version>2.2-beta-5</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <version>2.8</version>
+        </plugin>
+        <plugin>
+          <artifactId>maven-release-plugin</artifactId>
+          <version>2.3.2</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
   </build>
 
   <reporting>
@@ -76,7 +117,7 @@ under the License.
               <execution>
                 <id>attach-sources</id>
                 <goals>
-                  <goal>jar-no-fork</goal>
+                  <goal>jar</goal>
                 </goals>
               </execution>
             </executions>

http://git-wip-us.apache.org/repos/asf/maven/blob/a1da7315/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.1.0.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.1.0.xml b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.1.0.xml
new file mode 100644
index 0000000..39a5d5d
--- /dev/null
+++ b/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.1.0.xml
@@ -0,0 +1,109 @@
+<?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.
+-->
+
+<!-- START SNIPPET: superpom410 -->
+<project>
+  <modelVersion>4.1.0</modelVersion>
+
+  <build>
+    <directory>${project.basedir}/target</directory>
+    <outputDirectory>${project.build.directory}/classes</outputDirectory>
+    <finalName>${project.artifactId}-${project.version}</finalName>
+    <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
+    <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
+    <scriptSourceDirectory>${project.basedir}/src/main/scripts</scriptSourceDirectory>
+    <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
+    <resources>
+      <resource>
+        <directory>${project.basedir}/src/main/resources</directory>
+      </resource>
+      <resource>
+        <directory>${project.basedir}/src/main/resources-filtered</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+    <testResources>
+      <testResource>
+        <directory>${project.basedir}/src/test/resources</directory>
+      </testResource>
+      <testResource>
+        <directory>${project.basedir}/src/test/resources-filtered</directory>
+        <filtering>true</filtering>
+      </testResource>
+    </testResources>
+  </build>
+
+  <reporting>
+    <outputDirectory>${project.build.directory}/site</outputDirectory>
+  </reporting>
+
+  <profiles>
+    <!-- NOTE: The release profile will be removed from future versions of the super POM -->
+    <profile>
+      <id>release-profile</id>
+
+      <activation>
+        <property>
+          <name>performRelease</name>
+          <value>true</value>
+        </property>
+      </activation>
+
+      <build>
+        <plugins>
+          <plugin>
+            <inherited>true</inherited>
+            <artifactId>maven-source-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>attach-sources</id>
+                <goals>
+                  <goal>jar-no-fork</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <inherited>true</inherited>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>attach-javadocs</id>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <inherited>true</inherited>
+            <artifactId>maven-deploy-plugin</artifactId>
+            <configuration>
+              <updateReleaseInfo>true</updateReleaseInfo>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+</project>
+<!-- END SNIPPET: superpom410 -->