You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2020/12/24 13:09:46 UTC

[maven] branch MNG-7020 updated (ff89dc1 -> 9c21863)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch MNG-7020
in repository https://gitbox.apache.org/repos/asf/maven.git.


    omit ff89dc1  [MNG-7020] Remove Maven 2 WagonExcluder backward compat code
     add 827224c  [MNG-7019] Notify also at start when profile is missing
     add 3736be9  Updating version in preparation for Maven 4
     add b24c34b  [MNG-7041] Update @since, version ranges and other version related strings
     add d8ad76b  [MNG-5728] Switch the default checksum policy from "warn" to "fail"
     add 06c3217  Merge branch 'MNG-5728' of https://gitbox.apache.org/repos/asf/maven
     add b6cf710  [MNG-7042] Upgrade Maven Wagon to 3.4.2
     add 26f1e81  Merge branch 'master' of https://gitbox.apache.org/repos/asf/maven
     add 2bdc0c5  remove unused imports
     add 251ba22  Revert "[MNG-5728] Switch the default checksum policy from "warn" to "fail""
     add 95ee890  [MNG-5728] Switch the default checksum policy from "warn" to "fail"
     add be8ced6  [MNG-7034] StackOverflowError thrown if a cycle exists in BOM imports
     add d8c2cc7  [MNG-6566] Plugins that require a certain phase should not fork goals that are already in the execution plan.
     add 2ef0e5b  Upgrade github actions cache and use m2 cache for integration testing as well
     add 2609cdc  [MNG-7045] Drop CDI API from Maven
     add 9f88494  [MNG-6957] Versionless reactor dependencies/parent should work even if modules are aggregated in reverse order
     add 7e21a52  [MNG-4660] Increase usefulness of logging
     add d2adab7  [MNG-6054] Remove super POM plugin management section
     add 72a125e  [MNG-7022] Remove o.a.m.lifecycle.mapping.Lifecycle optional mojos backward compat code
     add 7f63dac  [MNG-7021] Remove old MHELP backward compat code
     new 9c21863  [MNG-7020] Remove Maven 2 WagonExcluder backward compat code

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ff89dc1)
            \
             N -- N -- N   refs/heads/MNG-7020 (9c21863)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/maven.yml                        |  14 +-
 apache-maven/maven-wrapper.pom                     |   2 +-
 apache-maven/pom.xml                               |   2 +-
 maven-artifact/pom.xml                             |   2 +-
 .../repository/ArtifactRepositoryPolicy.java       |   4 +-
 maven-builder-support/pom.xml                      |   2 +-
 maven-compat/pom.xml                               |   2 +-
 .../AbstractArtifactComponentTestCase.java         |  25 +
 .../repository/legacy/DefaultWagonManagerTest.java |   5 +
 maven-core/pom.xml                                 |   2 +-
 .../main/java/org/apache/maven/DefaultMaven.java   |   2 +
 .../main/java/org/apache/maven/ReactorReader.java  |  23 +-
 .../apache/maven/bridge/MavenRepositorySystem.java |  22 +-
 .../aether/ConsumerModelSourceTransformer.java     |   4 +-
 .../maven/lifecycle/DefaultLifecycleExecutor.java  |  22 -
 .../DefaultLifecycleExecutionPlanCalculator.java   |  84 ++-
 .../internal/LifecycleExecutionPlanCalculator.java |   5 +-
 .../apache/maven/lifecycle/mapping/Lifecycle.java  |   8 -
 .../maven/project/DefaultProjectBuilder.java       | 122 ++--
 .../apache/maven/project/ReactorModelCache.java    |   9 +-
 .../org/apache/maven/project/ReactorModelPool.java |   4 +-
 .../DefaultConsumerPomXMLFilterFactory.java        |  31 +-
 .../main/resources/META-INF/maven/extension.xml    |   4 +-
 .../maven/lifecycle/LifecycleExecutorTest.java     |   4 +-
 .../stub/LifecycleExecutionPlanCalculatorStub.java |   2 +-
 .../apache/maven/project/PomConstructionTest.java  |   2 +-
 .../test/resources/META-INF/plexus/components.xml  |   8 +-
 maven-embedder/pom.xml                             |   2 +-
 maven-model-builder/pom.xml                        |   2 +-
 .../java/org/apache/maven/feature/Features.java    |   4 +-
 .../building/AbstractModelSourceTransformer.java   |   2 +-
 .../maven/model/building/ArtifactModelSource.java  |   2 +-
 .../building/BuildModelSourceTransformer.java      |   4 +-
 .../building/DefaultBuildPomXMLFilterFactory.java  |  47 +-
 .../maven/model/building/DefaultModelBuilder.java  | 652 ++++++++++++++-------
 .../building/DefaultModelBuildingRequest.java      |  21 +-
 .../model/building/DefaultModelBuildingResult.java |  30 +
 .../building/DefaultModelSourceTransformer.java    |   2 +-
 .../model/building/DefaultTransformerContext.java  |  95 +++
 .../model/building/FilterModelBuildingRequest.java |  12 +-
 .../apache/maven/model/building/ModelBuilder.java  |   2 +
 .../maven/model/building/ModelBuildingRequest.java |  36 +-
 .../maven/model/building/ModelBuildingResult.java  |   7 +
 .../apache/maven/model/building/ModelCache.java    |   4 +-
 .../apache/maven/model/building/ModelCacheTag.java |  10 +-
 .../org/apache/maven/model/building/ModelData.java | 113 +---
 .../model/building/ModelSourceTransformer.java     |  16 +-
 .../maven/model/building/TransformerContext.java   |   8 +-
 .../model/building/TransformerContextBuilder.java  |  32 +-
 .../maven/model/building/TransformerException.java |   2 +-
 .../apache/maven/model/io/DefaultModelReader.java  |  14 +-
 .../org/apache/maven/model/io/ModelReader.java     |   6 +
 .../resources/org/apache/maven/model/pom-4.0.0.xml |  22 -
 maven-model-builder/src/site/apt/index.apt         |  27 +-
 .../model/building/DefaultModelBuilderTest.java    | 147 +++++
 .../validation/DefaultModelValidatorTest.java      |   4 -
 maven-model/pom.xml                                |   2 +-
 maven-model/src/main/mdo/maven.mdo                 |   7 +-
 maven-plugin-api/pom.xml                           |   2 +-
 maven-repository-metadata/pom.xml                  |   2 +-
 maven-resolver-provider/pom.xml                    |   2 +-
 .../internal/ArtifactDescriptorUtils.java          |  18 +-
 maven-settings-builder/pom.xml                     |   2 +-
 maven-settings/pom.xml                             |   2 +-
 maven-slf4j-provider/pom.xml                       |   2 +-
 maven-slf4j-wrapper/pom.xml                        |   2 +-
 maven-wrapper/pom.xml                              |   2 +-
 maven-xml/pom.xml                                  |   2 +-
 .../main/java/org/apache/maven/xml/Factories.java  |   2 +-
 .../java/org/apache/maven/xml/sax/SAXEvent.java    |   2 +-
 .../org/apache/maven/xml/sax/SAXEventFactory.java  |   2 +-
 .../org/apache/maven/xml/sax/SAXEventUtils.java    |   2 +-
 .../maven/xml/sax/ext/CommentRenormalizer.java     |   2 +-
 .../xml/sax/filter/AbstractEventXMLFilter.java     |   2 +-
 .../maven/xml/sax/filter/AbstractSAXFilter.java    |   2 +-
 .../maven/xml/sax/filter/BuildPomXMLFilter.java    |   2 +-
 .../xml/sax/filter/BuildPomXMLFilterFactory.java   |  47 +-
 .../xml/sax/filter/BuildPomXMLFilterListener.java  |   2 +-
 .../maven/xml/sax/filter/CiFriendlyXMLFilter.java  |  33 +-
 .../maven/xml/sax/filter/ConsumerPomXMLFilter.java |   2 +-
 .../sax/filter/ConsumerPomXMLFilterFactory.java    |  35 +-
 .../apache/maven/xml/sax/filter/DependencyKey.java |   2 +-
 .../maven/xml/sax/filter/FastForwardFilter.java    |   2 +-
 .../maven/xml/sax/filter/ModulesXMLFilter.java     |   2 +-
 .../maven/xml/sax/filter/ParentXMLFilter.java      |  73 ++-
 .../xml/sax/filter/ReactorDependencyXMLFilter.java |   2 +-
 .../xml/sax/filter/RelativePathXMLFilter.java      |   2 +-
 .../maven/xml/sax/filter/RelativeProject.java      |   2 +-
 .../apache/maven/xml/sax/ChainedFilterTest.java    |   2 +-
 .../xml/sax/filter/CiFriendlyXMLFilterTest.java    |   2 +-
 .../xml/sax/filter/ConsumerPomXMLFilterTest.java   |  19 +-
 .../maven/xml/sax/filter/ParentXMLFilterTest.java  |  37 +-
 pom.xml                                            |  10 +-
 93 files changed, 1286 insertions(+), 790 deletions(-)
 create mode 100644 maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultTransformerContext.java
 copy maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java => maven-model-builder/src/main/java/org/apache/maven/model/building/TransformerContextBuilder.java (54%)
 create mode 100644 maven-model-builder/src/test/java/org/apache/maven/model/building/DefaultModelBuilderTest.java


[maven] 01/01: [MNG-7020] Remove Maven 2 WagonExcluder backward compat code

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-7020
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 9c218632418b15705e8478718da81d4e07b22ab7
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Fri Nov 13 23:25:52 2020 +0100

    [MNG-7020] Remove Maven 2 WagonExcluder backward compat code
    
    This closes #394
---
 .../DefaultPluginDependenciesResolver.java         |   7 +-
 .../PluginDependencyResolutionListener.java        | 150 ---------------------
 .../maven/plugin/internal/WagonExcluder.java       | 109 ---------------
 3 files changed, 1 insertion(+), 265 deletions(-)

diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
index 709bd72..d31ba35 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
@@ -43,7 +43,6 @@ import org.eclipse.aether.artifact.Artifact;
 import org.eclipse.aether.artifact.DefaultArtifact;
 import org.eclipse.aether.collection.CollectRequest;
 import org.eclipse.aether.collection.DependencyCollectionException;
-import org.eclipse.aether.collection.DependencySelector;
 import org.eclipse.aether.graph.DependencyFilter;
 import org.eclipse.aether.graph.DependencyNode;
 import org.eclipse.aether.graph.DependencyVisitor;
@@ -59,7 +58,6 @@ import org.eclipse.aether.util.artifact.JavaScopes;
 import org.eclipse.aether.util.filter.AndDependencyFilter;
 import org.eclipse.aether.util.filter.ScopeDependencyFilter;
 import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
-import org.eclipse.aether.util.graph.selector.AndDependencySelector;
 import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
 
 /**
@@ -173,11 +171,8 @@ public class DefaultPluginDependenciesResolver
 
         try
         {
-            DependencySelector selector =
-                AndDependencySelector.newInstance( session.getDependencySelector(), new WagonExcluder() );
-
             DefaultRepositorySystemSession pluginSession = new DefaultRepositorySystemSession( session );
-            pluginSession.setDependencySelector( selector );
+            pluginSession.setDependencySelector( session.getDependencySelector() );
             pluginSession.setDependencyGraphTransformer( session.getDependencyGraphTransformer() );
 
             CollectRequest request = new CollectRequest();
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependencyResolutionListener.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependencyResolutionListener.java
deleted file mode 100644
index 42eb80e..0000000
--- a/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependencyResolutionListener.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.apache.maven.plugin.internal;
-
-/*
- * 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.IdentityHashMap;
-import java.util.LinkedList;
-import java.util.Map;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.ResolutionListener;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.versioning.VersionRange;
-
-/**
- * Assists in detecting wagon providers brought into the plugin class path via legacy Maven core artifacts (e.g.
- * maven-core:2.0.6) and excluding them. A plugin should be able to explicitly declare dependencies on specific wagons
- * for its use. However, the (old) wagons pulled in transitively via legacy Maven core artifacts are usually not
- * intended as dependencies and more importantly screw up artifact resolution because they would get preferred over the
- * core wagon versions. This is a hack to provide backward-compat with Maven 2 (MNG-4528, MNG-4561).
- *
- * @since 3.0
- * @author Benjamin Bentmann
- */
-class PluginDependencyResolutionListener
-    implements ResolutionListener
-{
-
-    private ArtifactFilter coreFilter;
-
-    private LinkedList<Artifact> coreArtifacts = new LinkedList<>();
-
-    private Artifact wagonProvider;
-
-    private Map<Artifact, Object> bannedArtifacts = new IdentityHashMap<>();
-
-    PluginDependencyResolutionListener( ArtifactFilter coreFilter )
-    {
-        this.coreFilter = coreFilter;
-    }
-
-    public void removeBannedDependencies( Collection<Artifact> artifacts )
-    {
-        if ( !bannedArtifacts.isEmpty() && artifacts != null )
-        {
-            artifacts.removeIf( artifact -> bannedArtifacts.containsKey( artifact ) );
-        }
-    }
-
-    public void startProcessChildren( Artifact artifact )
-    {
-        if ( wagonProvider == null )
-        {
-            if ( isLegacyCoreArtifact( artifact ) )
-            {
-                coreArtifacts.addFirst( artifact );
-            }
-            else if ( !coreArtifacts.isEmpty() && isWagonProvider( artifact ) )
-            {
-                wagonProvider = artifact;
-                bannedArtifacts.put( artifact, null );
-            }
-        }
-    }
-
-    private boolean isLegacyCoreArtifact( Artifact artifact )
-    {
-        String version = artifact.getVersion();
-        return version != null && version.startsWith( "2." ) && !coreFilter.include( artifact );
-    }
-
-    public void endProcessChildren( Artifact artifact )
-    {
-        if ( wagonProvider == artifact )
-        {
-            wagonProvider = null;
-        }
-        else if ( coreArtifacts.peek() == artifact )
-        {
-            coreArtifacts.removeFirst();
-        }
-    }
-
-    public void includeArtifact( Artifact artifact )
-    {
-        if ( wagonProvider != null )
-        {
-            bannedArtifacts.put( artifact, null );
-        }
-    }
-
-    private boolean isWagonProvider( Artifact artifact )
-    {
-        if ( "org.apache.maven.wagon".equals( artifact.getGroupId() ) )
-        {
-            return artifact.getArtifactId().startsWith( "wagon-" );
-        }
-        return false;
-    }
-
-    public void manageArtifact( Artifact artifact, Artifact replacement )
-    {
-    }
-
-    public void omitForCycle( Artifact artifact )
-    {
-    }
-
-    public void omitForNearer( Artifact omitted, Artifact kept )
-    {
-    }
-
-    public void restrictRange( Artifact artifact, Artifact replacement, VersionRange newRange )
-    {
-    }
-
-    public void selectVersionFromRange( Artifact artifact )
-    {
-    }
-
-    public void testArtifact( Artifact node )
-    {
-    }
-
-    public void updateScope( Artifact artifact, String scope )
-    {
-    }
-
-    public void updateScopeCurrentPom( Artifact artifact, String ignoredScope )
-    {
-    }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java
deleted file mode 100644
index d374cab..0000000
--- a/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.apache.maven.plugin.internal;
-
-/*
- * 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.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.collection.DependencyCollectionContext;
-import org.eclipse.aether.collection.DependencySelector;
-import org.eclipse.aether.graph.Dependency;
-
-/**
- * Assists in detecting wagon providers brought into the plugin class path via legacy Maven core artifacts (e.g.
- * maven-core:2.0.6) and excluding them. A plugin should be able to explicitly declare dependencies on specific wagons
- * for its use. However, the (old) wagons pulled in transitively via legacy Maven core artifacts are usually not
- * intended as dependencies and more importantly screw up artifact resolution because they would get preferred over the
- * core wagon versions. This is a hack to provide backward-compat with Maven 2 (MNG-4528, MNG-4561).
- *
- * @author Benjamin Bentmann
- */
-class WagonExcluder
-    implements DependencySelector
-{
-
-    private final boolean coreArtifact;
-
-    WagonExcluder()
-    {
-        this( false );
-    }
-
-    private WagonExcluder( boolean coreArtifact )
-    {
-        this.coreArtifact = coreArtifact;
-    }
-
-    public boolean selectDependency( Dependency dependency )
-    {
-        return !coreArtifact || !isWagonProvider( dependency.getArtifact() );
-    }
-
-    public DependencySelector deriveChildSelector( DependencyCollectionContext context )
-    {
-        if ( coreArtifact || !isLegacyCoreArtifact( context.getDependency().getArtifact() ) )
-        {
-            return this;
-        }
-        else
-        {
-            return new WagonExcluder( true );
-        }
-    }
-
-    private boolean isLegacyCoreArtifact( Artifact artifact )
-    {
-        String version = artifact.getVersion();
-        return version != null && version.startsWith( "2." ) && artifact.getArtifactId().startsWith( "maven-" )
-            && artifact.getGroupId().equals( "org.apache.maven" );
-    }
-
-    private boolean isWagonProvider( Artifact artifact )
-    {
-        if ( "org.apache.maven.wagon".equals( artifact.getGroupId() ) )
-        {
-            return artifact.getArtifactId().startsWith( "wagon-" );
-        }
-        return false;
-    }
-
-    @Override
-    public boolean equals( Object obj )
-    {
-        if ( obj == this )
-        {
-            return true;
-        }
-        else if ( obj == null || !getClass().equals( obj.getClass() ) )
-        {
-            return false;
-        }
-
-        WagonExcluder that = (WagonExcluder) obj;
-        return coreArtifact == that.coreArtifact;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        int hash = getClass().hashCode();
-        hash = hash * 31 + ( coreArtifact ? 1 : 0 );
-        return hash;
-    }
-
-}