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

cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new 76794c0237 [MNG-8043] Dependency properties should be provided by 
Maven (#1399)
76794c0237 is described below

commit 76794c0237f1b6e3cc42c31e076f3345398b2044
Author: Tamas Cservenak <[email protected]>
AuthorDate: Wed Feb 7 10:51:56 2024 +0100

    [MNG-8043] Dependency properties should be provided by Maven (#1399)
    
    Followup of MRESOLVER-484:
    * move off deprecated resolver bits
    * introduce non-deprecated replacements
    * move existing to code to those new bits
    
    ---
    
    https://issues.apache.org/jira/browse/MNG-8043
---
 .../java/org/apache/maven/api/DependencyScope.java |   6 +-
 .../org/apache/maven/api/spi/TypeProvider.java     |  25 +----
 .../maven/internal/aether/TypeRegistryAdapter.java |   2 +-
 .../maven/internal/impl/DefaultTypeRegistry.java   |  36 +++----
 .../maven/internal/impl/types/EarTypeProvider.java |  44 --------
 .../internal/impl/types/EjbClientTypeProvider.java |  44 --------
 .../maven/internal/impl/types/EjbTypeProvider.java |  44 --------
 .../maven/internal/impl/types/JarTypeProvider.java |  44 --------
 .../impl/types/JavaSourceTypeProvider.java         |  44 --------
 .../internal/impl/types/JavadocTypeProvider.java   |  44 --------
 .../impl/types/MavenPluginTypeProvider.java        |  44 --------
 .../maven/internal/impl/types/ParTypeProvider.java |  44 --------
 .../maven/internal/impl/types/PomTypeProvider.java |  44 --------
 .../maven/internal/impl/types/RarTypeProvider.java |  44 --------
 .../internal/impl/types/TestJarTypeProvider.java   |  44 --------
 .../maven/internal/impl/types/WarTypeProvider.java |  44 --------
 .../DefaultPluginDependenciesResolver.java         |   6 +-
 .../Maven3CompatDependenciesValidator.java         |   4 +-
 .../internal/MavenScopeDependenciesValidator.java  |   5 +-
 .../project/DefaultModelBuildingListener.java      |   4 +-
 .../DefaultProjectDependenciesResolver.java        |   4 +-
 .../internal/MavenRepositorySystemUtils.java       | 112 ++-------------------
 .../internal/MavenSessionBuilderSupplier.java      |  34 ++++---
 .../internal/artifact/FatArtifactTraverser.java    |  67 ++++++++++++
 .../internal/artifact/MavenArtifactProperties.java |  48 +++++++++
 .../scopes/MavenDependencyContextRefiner.java      |   3 +
 .../internal/scopes/MavenDependencyScopes.java     |   6 +-
 .../internal/scopes/MavenScopeDeriver.java         |   3 -
 .../internal/scopes/MavenScopeSelector.java        |   3 -
 .../repository/internal/type}/DefaultType.java     |  34 ++++---
 .../internal/type/DefaultTypeProvider.java         |  54 ++++++++++
 31 files changed, 258 insertions(+), 726 deletions(-)

diff --git 
a/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyScope.java 
b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyScope.java
index 2b4d410064..047ab1c3ab 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyScope.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyScope.java
@@ -92,7 +92,7 @@ public enum DependencyScope {
      * System scope.
      * <p>
      * Important: this scope {@code id} MUST BE KEPT in sync with label in
-     * {@code org.eclipse.aether.util.artifact.Scopes#SYSTEM}.
+     * {@code org.eclipse.aether.util.artifact.DependencyScopes#SYSTEM}.
      */
     SYSTEM("system", false);
 
@@ -125,4 +125,8 @@ public enum DependencyScope {
     public boolean isTransitive() {
         return transitive;
     }
+
+    public boolean is(String id) {
+        return id().equals(id);
+    }
 }
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/BomTypeProvider.java
 b/api/maven-api-spi/src/main/java/org/apache/maven/api/spi/TypeProvider.java
similarity index 58%
rename from 
maven-core/src/main/java/org/apache/maven/internal/impl/types/BomTypeProvider.java
rename to 
api/maven-api-spi/src/main/java/org/apache/maven/api/spi/TypeProvider.java
index 801bfef782..a47e99b586 100644
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/BomTypeProvider.java
+++ b/api/maven-api-spi/src/main/java/org/apache/maven/api/spi/TypeProvider.java
@@ -16,29 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.internal.impl.types;
+package org.apache.maven.api.spi;
 
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
 import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(BomTypeProvider.NAME)
-@Singleton
-public class BomTypeProvider implements Provider<Type> {
-    public static final String NAME = "bom";
-
-    private final Type type;
-
-    public BomTypeProvider() {
-        this.type = new DefaultType(NAME, Language.NONE, "pom", null, false, 
false);
-    }
 
-    @Override
-    public Type get() {
-        return type;
-    }
-}
+public interface TypeProvider extends ExtensibleEnumProvider<Type> {}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/aether/TypeRegistryAdapter.java
 
b/maven-core/src/main/java/org/apache/maven/internal/aether/TypeRegistryAdapter.java
index e06dd9e13c..89f00b4138 100644
--- 
a/maven-core/src/main/java/org/apache/maven/internal/aether/TypeRegistryAdapter.java
+++ 
b/maven-core/src/main/java/org/apache/maven/internal/aether/TypeRegistryAdapter.java
@@ -20,7 +20,7 @@ package org.apache.maven.internal.aether;
 
 import org.apache.maven.api.Type;
 import org.apache.maven.api.services.TypeRegistry;
-import org.apache.maven.internal.impl.DefaultType;
+import org.apache.maven.repository.internal.type.DefaultType;
 import org.eclipse.aether.artifact.ArtifactType;
 import org.eclipse.aether.artifact.ArtifactTypeRegistry;
 
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultTypeRegistry.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultTypeRegistry.java
index faf8d4ca93..5142f9f9c3 100644
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultTypeRegistry.java
+++ 
b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultTypeRegistry.java
@@ -22,19 +22,24 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Singleton;
 
+import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
 
 import org.apache.maven.api.Type;
 import org.apache.maven.api.annotations.Nonnull;
 import org.apache.maven.api.services.LanguageRegistry;
 import org.apache.maven.api.services.TypeRegistry;
+import org.apache.maven.api.spi.TypeProvider;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.manager.LegacyArtifactHandlerManager;
 import org.apache.maven.eventspy.AbstractEventSpy;
 import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.repository.internal.type.DefaultType;
 
+import static java.util.function.Function.identity;
 import static org.apache.maven.internal.impl.Utils.nonNull;
 
 @Named
@@ -46,17 +51,16 @@ public class DefaultTypeRegistry extends AbstractEventSpy 
implements TypeRegistr
 
     private final ConcurrentHashMap<String, Type> usedTypes;
 
-    private final ConcurrentHashMap<String, Type> legacyTypes;
-
     private final LegacyArtifactHandlerManager manager;
 
     @Inject
     public DefaultTypeRegistry(
-            Map<String, Type> types, LanguageRegistry languageRegistry, 
LegacyArtifactHandlerManager manager) {
-        this.types = nonNull(types, "types");
+            List<TypeProvider> providers, LanguageRegistry languageRegistry, 
LegacyArtifactHandlerManager manager) {
+        this.types = nonNull(providers, "providers").stream()
+                .flatMap(p -> p.provides().stream())
+                .collect(Collectors.toMap(Type::id, identity()));
         this.languageRegistry = nonNull(languageRegistry, "languageRegistry");
         this.usedTypes = new ConcurrentHashMap<>();
-        this.legacyTypes = new ConcurrentHashMap<>();
         this.manager = nonNull(manager, "artifactHandlerManager");
     }
 
@@ -66,7 +70,6 @@ public class DefaultTypeRegistry extends AbstractEventSpy 
implements TypeRegistr
             ExecutionEvent executionEvent = (ExecutionEvent) event;
             if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
                 usedTypes.clear();
-                legacyTypes.clear();
             }
         }
     }
@@ -83,18 +86,15 @@ public class DefaultTypeRegistry extends AbstractEventSpy 
implements TypeRegistr
         return usedTypes.computeIfAbsent(id, i -> {
             Type type = types.get(id);
             if (type == null) {
-                // legacy types ALWAYS return type (AHM never returns null)
-                type = legacyTypes.computeIfAbsent(id, k -> {
-                    // Copy data as the ArtifactHandler is not immutable, but 
Type should be.
-                    ArtifactHandler handler = manager.getArtifactHandler(id);
-                    return new DefaultType(
-                            id,
-                            languageRegistry.require(handler.getLanguage()),
-                            handler.getExtension(),
-                            handler.getClassifier(),
-                            handler.isAddedToClasspath(),
-                            handler.isIncludesDependencies());
-                });
+                // Copy data as the ArtifactHandler is not immutable, but Type 
should be.
+                ArtifactHandler handler = manager.getArtifactHandler(id);
+                type = new DefaultType(
+                        id,
+                        languageRegistry.require(handler.getLanguage()),
+                        handler.getExtension(),
+                        handler.getClassifier(),
+                        handler.isAddedToClasspath(),
+                        handler.isIncludesDependencies());
             }
             return type;
         });
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/EarTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/EarTypeProvider.java
deleted file mode 100644
index 5512b8e442..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/EarTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(EarTypeProvider.NAME)
-@Singleton
-public class EarTypeProvider implements Provider<Type> {
-    public static final String NAME = "ear";
-
-    private final Type type;
-
-    public EarTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "ear", null, 
false, true);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/EjbClientTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/EjbClientTypeProvider.java
deleted file mode 100644
index a1a97dfcbb..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/EjbClientTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(EjbClientTypeProvider.NAME)
-@Singleton
-public class EjbClientTypeProvider implements Provider<Type> {
-    public static final String NAME = "ejb-client";
-
-    private final Type type;
-
-    public EjbClientTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "jar", 
"client", true, false);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/EjbTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/EjbTypeProvider.java
deleted file mode 100644
index 01a8dfcb9f..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/EjbTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(EjbTypeProvider.NAME)
-@Singleton
-public class EjbTypeProvider implements Provider<Type> {
-    public static final String NAME = "ejb";
-
-    private final Type type;
-
-    public EjbTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "jar", null, 
true, false);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/JarTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/JarTypeProvider.java
deleted file mode 100644
index df61f6bd3b..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/JarTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(JarTypeProvider.NAME)
-@Singleton
-public class JarTypeProvider implements Provider<Type> {
-    public static final String NAME = "jar";
-
-    private final Type type;
-
-    public JarTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "jar", null, 
true, false);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/JavaSourceTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/JavaSourceTypeProvider.java
deleted file mode 100644
index 4e90d4591a..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/JavaSourceTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(JavaSourceTypeProvider.NAME)
-@Singleton
-public class JavaSourceTypeProvider implements Provider<Type> {
-    public static final String NAME = "java-source";
-
-    private final Type type;
-
-    public JavaSourceTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "jar", 
"sources", false, false);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/JavadocTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/JavadocTypeProvider.java
deleted file mode 100644
index 1f6e9aee8f..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/JavadocTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(JavadocTypeProvider.NAME)
-@Singleton
-public class JavadocTypeProvider implements Provider<Type> {
-    public static final String NAME = "javadoc";
-
-    private final Type type;
-
-    public JavadocTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "jar", 
"javadoc", true, false);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/MavenPluginTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/MavenPluginTypeProvider.java
deleted file mode 100644
index ec5a45ff55..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/MavenPluginTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(MavenPluginTypeProvider.NAME)
-@Singleton
-public class MavenPluginTypeProvider implements Provider<Type> {
-    public static final String NAME = "maven-plugin";
-
-    private final Type type;
-
-    public MavenPluginTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "jar", null, 
true, false);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/ParTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/ParTypeProvider.java
deleted file mode 100644
index b804b69597..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/ParTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(ParTypeProvider.NAME)
-@Singleton
-public class ParTypeProvider implements Provider<Type> {
-    public static final String NAME = "par";
-
-    private final Type type;
-
-    public ParTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "par", null, 
false, true);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/PomTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/PomTypeProvider.java
deleted file mode 100644
index 9f38564116..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/PomTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(PomTypeProvider.NAME)
-@Singleton
-public class PomTypeProvider implements Provider<Type> {
-    public static final String NAME = "pom";
-
-    private final Type type;
-
-    public PomTypeProvider() {
-        this.type = new DefaultType(NAME, Language.NONE, "pom", null, false, 
false);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/RarTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/RarTypeProvider.java
deleted file mode 100644
index 39e36777c0..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/RarTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(RarTypeProvider.NAME)
-@Singleton
-public class RarTypeProvider implements Provider<Type> {
-    public static final String NAME = "rar";
-
-    private final Type type;
-
-    public RarTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "rar", null, 
false, true);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/TestJarTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/TestJarTypeProvider.java
deleted file mode 100644
index 39f9653e9f..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/TestJarTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(TestJarTypeProvider.NAME)
-@Singleton
-public class TestJarTypeProvider implements Provider<Type> {
-    public static final String NAME = "test-jar";
-
-    private final Type type;
-
-    public TestJarTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "jar", 
"tests", true, false);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/WarTypeProvider.java
 
b/maven-core/src/main/java/org/apache/maven/internal/impl/types/WarTypeProvider.java
deleted file mode 100644
index 732ff09a7e..0000000000
--- 
a/maven-core/src/main/java/org/apache/maven/internal/impl/types/WarTypeProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.internal.impl.types;
-
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.api.Language;
-import org.apache.maven.api.Type;
-import org.apache.maven.internal.impl.DefaultType;
-
-@Named(WarTypeProvider.NAME)
-@Singleton
-public class WarTypeProvider implements Provider<Type> {
-    public static final String NAME = "war";
-
-    private final Type type;
-
-    public WarTypeProvider() {
-        this.type = new DefaultType(NAME, Language.JAVA_FAMILY, "war", null, 
false, true);
-    }
-
-    @Override
-    public Type get() {
-        return type;
-    }
-}
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 4cc6082153..1253e471a8 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
@@ -29,10 +29,10 @@ import java.util.Map;
 import java.util.Objects;
 
 import org.apache.maven.RepositoryUtils;
+import org.apache.maven.api.DependencyScope;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.plugin.PluginResolutionException;
-import org.apache.maven.repository.internal.scopes.MavenDependencyScopes;
 import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.RepositorySystem;
 import org.eclipse.aether.RepositorySystemSession;
@@ -211,8 +211,8 @@ public class DefaultPluginDependenciesResolver implements 
PluginDependenciesReso
             for (Dependency dependency : plugin.getDependencies()) {
                 org.eclipse.aether.graph.Dependency pluginDep =
                         RepositoryUtils.toDependency(dependency, 
session.getArtifactTypeRegistry());
-                if 
(!MavenDependencyScopes.SYSTEM.equals(pluginDep.getScope())) {
-                    pluginDep = 
pluginDep.setScope(MavenDependencyScopes.RUNTIME);
+                if (!DependencyScope.SYSTEM.is(pluginDep.getScope())) {
+                    pluginDep = 
pluginDep.setScope(DependencyScope.RUNTIME.id());
                 }
                 request.addDependency(pluginDep);
             }
diff --git 
a/maven-core/src/main/java/org/apache/maven/plugin/internal/Maven3CompatDependenciesValidator.java
 
b/maven-core/src/main/java/org/apache/maven/plugin/internal/Maven3CompatDependenciesValidator.java
index 495436419d..0cf8fee6ad 100644
--- 
a/maven-core/src/main/java/org/apache/maven/plugin/internal/Maven3CompatDependenciesValidator.java
+++ 
b/maven-core/src/main/java/org/apache/maven/plugin/internal/Maven3CompatDependenciesValidator.java
@@ -22,8 +22,8 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Singleton;
 
+import org.apache.maven.api.DependencyScope;
 import org.apache.maven.plugin.PluginValidationManager;
-import org.apache.maven.repository.internal.scopes.MavenDependencyScopes;
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.artifact.Artifact;
 import org.eclipse.aether.resolution.ArtifactDescriptorResult;
@@ -50,7 +50,7 @@ class Maven3CompatDependenciesValidator extends 
AbstractMavenPluginDependenciesV
         for (org.eclipse.aether.graph.Dependency dependency : 
artifactDescriptorResult.getDependencies()) {
             if 
("org.apache.maven".equals(dependency.getArtifact().getGroupId())
                     && 
"maven-compat".equals(dependency.getArtifact().getArtifactId())
-                    && 
!MavenDependencyScopes.TEST.equals(dependency.getScope())) {
+                    && !DependencyScope.TEST.is(dependency.getScope())) {
                 pluginValidationManager.reportPluginValidationIssue(
                         PluginValidationManager.IssueLocality.EXTERNAL,
                         session,
diff --git 
a/maven-core/src/main/java/org/apache/maven/plugin/internal/MavenScopeDependenciesValidator.java
 
b/maven-core/src/main/java/org/apache/maven/plugin/internal/MavenScopeDependenciesValidator.java
index 796a5b95f6..460a91c6ec 100644
--- 
a/maven-core/src/main/java/org/apache/maven/plugin/internal/MavenScopeDependenciesValidator.java
+++ 
b/maven-core/src/main/java/org/apache/maven/plugin/internal/MavenScopeDependenciesValidator.java
@@ -25,8 +25,8 @@ import javax.inject.Singleton;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import org.apache.maven.api.DependencyScope;
 import org.apache.maven.plugin.PluginValidationManager;
-import org.apache.maven.repository.internal.scopes.MavenDependencyScopes;
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.artifact.Artifact;
 import org.eclipse.aether.resolution.ArtifactDescriptorResult;
@@ -51,8 +51,7 @@ class MavenScopeDependenciesValidator extends 
AbstractMavenPluginDependenciesVal
             Artifact pluginArtifact,
             ArtifactDescriptorResult artifactDescriptorResult) {
         Set<String> mavenArtifacts = 
artifactDescriptorResult.getDependencies().stream()
-                .filter(d -> 
!MavenDependencyScopes.PROVIDED.equals(d.getScope())
-                        && !MavenDependencyScopes.TEST.equals(d.getScope()))
+                .filter(d -> !DependencyScope.PROVIDED.is(d.getScope()) && 
!DependencyScope.TEST.is(d.getScope()))
                 .map(org.eclipse.aether.graph.Dependency::getArtifact)
                 .filter(a -> "org.apache.maven".equals(a.getGroupId()))
                 .filter(a -> 
!DefaultPluginValidationManager.EXPECTED_PROVIDED_SCOPE_EXCLUSIONS_GA.contains(
diff --git 
a/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
 
b/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
index 2b2f2fff29..bf0a300fea 100644
--- 
a/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
+++ 
b/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
@@ -40,9 +40,9 @@ public class DefaultModelBuildingListener extends 
AbstractModelBuildingListener
 
     private final MavenProject project;
 
-    private ProjectBuildingHelper projectBuildingHelper;
+    private final ProjectBuildingHelper projectBuildingHelper;
 
-    private ProjectBuildingRequest projectBuildingRequest;
+    private final ProjectBuildingRequest projectBuildingRequest;
 
     private List<ArtifactRepository> remoteRepositories;
 
diff --git 
a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
 
b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
index 87a974f0cd..b4f3b67578 100644
--- 
a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
+++ 
b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
@@ -29,11 +29,11 @@ import java.util.Map;
 import java.util.Objects;
 
 import org.apache.maven.RepositoryUtils;
+import org.apache.maven.api.DependencyScope;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.model.DependencyManagement;
 import org.apache.maven.model.Exclusion;
-import org.apache.maven.repository.internal.scopes.MavenDependencyScopes;
 import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.RepositorySystem;
 import org.eclipse.aether.RepositorySystemSession;
@@ -130,7 +130,7 @@ public class DefaultProjectDependenciesResolver implements 
ProjectDependenciesRe
                 Dependency dependency = dependencies.get(key);
                 Collection<Exclusion> exclusions = dependency != null ? 
dependency.getExclusions() : null;
                 org.eclipse.aether.graph.Dependency dep = 
RepositoryUtils.toDependency(artifact, exclusions);
-                if (!MavenDependencyScopes.SYSTEM.equals(dep.getScope())
+                if (!DependencyScope.SYSTEM.is(dep.getScope())
                         && dep.getArtifact().getFile() != null) {
                     // enable re-resolution
                     org.eclipse.aether.artifact.Artifact art = 
dep.getArtifact();
diff --git 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
index a87b6cefdc..63631f019b 100644
--- 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemUtils.java
@@ -18,31 +18,8 @@
  */
 package org.apache.maven.repository.internal;
 
-import 
org.apache.maven.repository.internal.scopes.MavenDependencyContextRefiner;
-import org.apache.maven.repository.internal.scopes.MavenScopeDeriver;
-import org.apache.maven.repository.internal.scopes.MavenScopeSelector;
 import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystemSession.SessionBuilder;
-import org.eclipse.aether.artifact.ArtifactTypeRegistry;
-import org.eclipse.aether.artifact.DefaultArtifactType;
-import org.eclipse.aether.collection.DependencyGraphTransformer;
-import org.eclipse.aether.collection.DependencyManager;
-import org.eclipse.aether.collection.DependencySelector;
-import org.eclipse.aether.collection.DependencyTraverser;
-import org.eclipse.aether.util.artifact.DefaultArtifactTypeRegistry;
 import org.eclipse.aether.util.graph.manager.ClassicDependencyManager;
-import org.eclipse.aether.util.graph.selector.AndDependencySelector;
-import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector;
-import org.eclipse.aether.util.graph.selector.OptionalDependencySelector;
-import org.eclipse.aether.util.graph.selector.ScopeDependencySelector;
-import 
org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
-import org.eclipse.aether.util.graph.transformer.ConflictResolver;
-import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
-import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
-import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
-import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
-
-import static java.util.Objects.requireNonNull;
 
 /**
  * A utility class to assist in setting up a Maven-like repository system. 
<em>Note:</em> This component is meant to
@@ -66,88 +43,13 @@ public final class MavenRepositorySystemUtils {
     @Deprecated
     public static DefaultRepositorySystemSession newSession() {
         DefaultRepositorySystemSession session = new 
DefaultRepositorySystemSession(h -> false); // no close handle
-
-        DependencyTraverser depTraverser = new FatArtifactTraverser();
-        session.setDependencyTraverser(depTraverser);
-
-        DependencyManager depManager = new ClassicDependencyManager();
-        session.setDependencyManager(depManager);
-
-        DependencySelector depFilter = new AndDependencySelector(
-                new ScopeDependencySelector("test", "provided"),
-                new OptionalDependencySelector(),
-                new ExclusionDependencySelector());
-        session.setDependencySelector(depFilter);
-
-        DependencyGraphTransformer transformer = new ConflictResolver(
-                new NearestVersionSelector(), new MavenScopeSelector(),
-                new SimpleOptionalitySelector(), new MavenScopeDeriver());
-        transformer = new ChainedDependencyGraphTransformer(transformer, new 
MavenDependencyContextRefiner());
-        session.setDependencyGraphTransformer(transformer);
-
-        session.setArtifactTypeRegistry(newArtifactTypeRegistry());
-
-        session.setArtifactDescriptorPolicy(new 
SimpleArtifactDescriptorPolicy(true, true));
-
-        return session;
-    }
-
-    /**
-     * Creates new Maven-like {@link ArtifactTypeRegistry}. This method should 
not be used from Maven.
-     *
-     * @since 4.0.0
-     */
-    public static ArtifactTypeRegistry newArtifactTypeRegistry() {
-        DefaultArtifactTypeRegistry stereotypes = new 
DefaultArtifactTypeRegistry();
-        stereotypes.add(new DefaultArtifactType("pom"));
-        stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", 
"java"));
-        stereotypes.add(new DefaultArtifactType("jar", "jar", "", "java"));
-        stereotypes.add(new DefaultArtifactType("ejb", "jar", "", "java"));
-        stereotypes.add(new DefaultArtifactType("ejb-client", "jar", "client", 
"java"));
-        stereotypes.add(new DefaultArtifactType("test-jar", "jar", "tests", 
"java"));
-        stereotypes.add(new DefaultArtifactType("javadoc", "jar", "javadoc", 
"java"));
-        stereotypes.add(new DefaultArtifactType("java-source", "jar", 
"sources", "java", false, false));
-        stereotypes.add(new DefaultArtifactType("war", "war", "", "java", 
false, true));
-        stereotypes.add(new DefaultArtifactType("ear", "ear", "", "java", 
false, true));
-        stereotypes.add(new DefaultArtifactType("rar", "rar", "", "java", 
false, true));
-        stereotypes.add(new DefaultArtifactType("par", "par", "", "java", 
false, true));
-        return stereotypes;
-    }
-
-    /**
-     * Creates a new Maven-like repository system session by initializing the 
session with values typical for
-     * Maven-based resolution. In more detail, this method configures settings 
relevant for the processing of dependency
-     * graphs, most other settings remain at their generic default value. Use 
the various setters to further configure
-     * the session with authentication, mirror, proxy and other information 
required for your environment.
-     *
-     * @return The new repository system session, never {@code null}.
-     * @since 4.0.0
-     */
-    public static SessionBuilder newSession(SessionBuilder session, 
ArtifactTypeRegistry artifactTypeRegistry) {
-        requireNonNull(session, "null sessionBuilder");
-        requireNonNull(artifactTypeRegistry, "null artifactTypeRegistry");
-
-        DependencyTraverser depTraverser = new FatArtifactTraverser();
-        session.setDependencyTraverser(depTraverser);
-
-        DependencyManager depManager = new ClassicDependencyManager();
-        session.setDependencyManager(depManager);
-
-        DependencySelector depFilter = new AndDependencySelector(
-                new ScopeDependencySelector("test", "provided"),
-                new OptionalDependencySelector(),
-                new ExclusionDependencySelector());
-        session.setDependencySelector(depFilter);
-
-        DependencyGraphTransformer transformer = new ConflictResolver(
-                new NearestVersionSelector(), new MavenScopeSelector(),
-                new SimpleOptionalitySelector(), new MavenScopeDeriver());
-        transformer = new ChainedDependencyGraphTransformer(transformer, new 
MavenDependencyContextRefiner());
-        session.setDependencyGraphTransformer(transformer);
-        session.setArtifactTypeRegistry(artifactTypeRegistry);
-
-        session.setArtifactDescriptorPolicy(new 
SimpleArtifactDescriptorPolicy(true, true));
-
+        MavenSessionBuilderSupplier builder = new 
MavenSessionBuilderSupplier();
+        session.setDependencyTraverser(builder.getDependencyTraverser());
+        session.setDependencyManager(new ClassicDependencyManager()); // Maven 
3 behavior
+        session.setDependencySelector(builder.getDependencySelector());
+        
session.setDependencyGraphTransformer(builder.getDependencyGraphTransformer());
+        session.setArtifactTypeRegistry(builder.getArtifactTypeRegistry());
+        
session.setArtifactDescriptorPolicy(builder.getArtifactDescriptorPolicy());
         return session;
     }
 }
diff --git 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenSessionBuilderSupplier.java
 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenSessionBuilderSupplier.java
index 5400f43675..8746fa457b 100644
--- 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenSessionBuilderSupplier.java
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenSessionBuilderSupplier.java
@@ -20,14 +20,15 @@ package org.apache.maven.repository.internal;
 
 import java.util.function.Supplier;
 
+import org.apache.maven.repository.internal.artifact.FatArtifactTraverser;
 import 
org.apache.maven.repository.internal.scopes.MavenDependencyContextRefiner;
 import org.apache.maven.repository.internal.scopes.MavenScopeDeriver;
 import org.apache.maven.repository.internal.scopes.MavenScopeSelector;
+import org.apache.maven.repository.internal.type.DefaultTypeProvider;
 import org.eclipse.aether.RepositorySystem;
 import org.eclipse.aether.RepositorySystemSession.CloseableSession;
 import org.eclipse.aether.RepositorySystemSession.SessionBuilder;
 import org.eclipse.aether.artifact.ArtifactTypeRegistry;
-import org.eclipse.aether.artifact.DefaultArtifactType;
 import org.eclipse.aether.collection.DependencyGraphTransformer;
 import org.eclipse.aether.collection.DependencyManager;
 import org.eclipse.aether.collection.DependencySelector;
@@ -43,7 +44,6 @@ import 
org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransform
 import org.eclipse.aether.util.graph.transformer.ConflictResolver;
 import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
 import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
-import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
 import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
 
 import static java.util.Objects.requireNonNull;
@@ -64,6 +64,14 @@ public class MavenSessionBuilderSupplier implements 
Supplier<SessionBuilder> {
         this.repositorySystem = requireNonNull(repositorySystem);
     }
 
+    /**
+     * Package protected constructor, only for use with {@link 
MavenRepositorySystemUtils}.
+     */
+    @Deprecated
+    MavenSessionBuilderSupplier() {
+        this.repositorySystem = null;
+    }
+
     protected DependencyTraverser getDependencyTraverser() {
         return new FatArtifactTraverser();
     }
@@ -87,20 +95,18 @@ public class MavenSessionBuilderSupplier implements 
Supplier<SessionBuilder> {
                 new MavenDependencyContextRefiner());
     }
 
+    /**
+     * This method produces "surrogate" type registry that is static: it aims 
users that want to use
+     * Maven-Resolver without involving Maven Core and related things.
+     * <p>
+     * This type registry is NOT used by Maven Core: Maven replaces it during 
Session creation with a type registry
+     * that supports extending it (i.e. via Maven Extensions).
+     * <p>
+     * Important: this "static" list of types should be in-sync with core 
provided types.
+     */
     protected ArtifactTypeRegistry getArtifactTypeRegistry() {
         DefaultArtifactTypeRegistry stereotypes = new 
DefaultArtifactTypeRegistry();
-        stereotypes.add(new DefaultArtifactType("pom"));
-        stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", 
"java"));
-        stereotypes.add(new DefaultArtifactType("jar", "jar", "", "java"));
-        stereotypes.add(new DefaultArtifactType("ejb", "jar", "", "java"));
-        stereotypes.add(new DefaultArtifactType("ejb-client", "jar", "client", 
"java"));
-        stereotypes.add(new DefaultArtifactType("test-jar", "jar", "tests", 
"java"));
-        stereotypes.add(new DefaultArtifactType("javadoc", "jar", "javadoc", 
"java"));
-        stereotypes.add(new DefaultArtifactType("java-source", "jar", 
"sources", "java", false, false));
-        stereotypes.add(new DefaultArtifactType("war", "war", "", "java", 
false, true));
-        stereotypes.add(new DefaultArtifactType("ear", "ear", "", "java", 
false, true));
-        stereotypes.add(new DefaultArtifactType("rar", "rar", "", "java", 
false, true));
-        stereotypes.add(new DefaultArtifactType("par", "par", "", "java", 
false, true));
+        new DefaultTypeProvider().types().forEach(stereotypes::add);
         return stereotypes;
     }
 
diff --git 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/artifact/FatArtifactTraverser.java
 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/artifact/FatArtifactTraverser.java
new file mode 100644
index 0000000000..4e6df4d39c
--- /dev/null
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/artifact/FatArtifactTraverser.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+package org.apache.maven.repository.internal.artifact;
+
+import org.eclipse.aether.collection.DependencyCollectionContext;
+import org.eclipse.aether.collection.DependencyTraverser;
+import org.eclipse.aether.graph.Dependency;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * A dependency traverser that excludes the dependencies of fat artifacts from 
the traversal. Fat artifacts are
+ * artifacts that have the property {@link 
MavenArtifactProperties#INCLUDES_DEPENDENCIES} set to
+ * {@code true}.
+ *
+ * @see org.eclipse.aether.artifact.Artifact#getProperties()
+ * @see MavenArtifactProperties
+ * @since 4.0.0
+ */
+public final class FatArtifactTraverser implements DependencyTraverser {
+
+    public FatArtifactTraverser() {}
+
+    @Override
+    public boolean traverseDependency(Dependency dependency) {
+        requireNonNull(dependency, "dependency cannot be null");
+        String prop = 
dependency.getArtifact().getProperty(MavenArtifactProperties.INCLUDES_DEPENDENCIES,
 "");
+        return !Boolean.parseBoolean(prop);
+    }
+
+    @Override
+    public DependencyTraverser 
deriveChildTraverser(DependencyCollectionContext context) {
+        requireNonNull(context, "context cannot be null");
+        return this;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (null == obj || !getClass().equals(obj.getClass())) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return getClass().hashCode();
+    }
+}
diff --git 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/artifact/MavenArtifactProperties.java
 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/artifact/MavenArtifactProperties.java
new file mode 100644
index 0000000000..5f591f8a1a
--- /dev/null
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/artifact/MavenArtifactProperties.java
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.apache.maven.repository.internal.artifact;
+
+/**
+ * The keys for Maven specific properties of artifacts. These properties 
"extend" (or supplement) the Resolver
+ * core properties defined in {@link 
org.eclipse.aether.artifact.ArtifactProperties}.
+ *
+ * @see org.eclipse.aether.artifact.ArtifactProperties
+ * @since 4.0.0
+ */
+public final class MavenArtifactProperties {
+    /**
+     * A boolean flag indicating whether the artifact presents some kind of 
bundle that physically includes its
+     * dependencies, e.g. a fat WAR.
+     */
+    public static final String INCLUDES_DEPENDENCIES = "includesDependencies";
+
+    /**
+     * A boolean flag indicating whether the artifact is meant to be used for 
the compile/runtime/test build path of a
+     * consumer project.
+     * <p>
+     * Note: This property is about "build path", whatever it means in the 
scope of the consumer project. It is NOT
+     * about Java classpath or anything alike. How artifact is being consumed 
depends heavily on the consumer project.
+     * Resolver is and will remain agnostic of consumer project use cases.
+     */
+    public static final String CONSTITUTES_BUILD_PATH = "constitutesBuildPath";
+
+    private MavenArtifactProperties() {
+        // hide constructor
+    }
+}
diff --git 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenDependencyContextRefiner.java
 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenDependencyContextRefiner.java
index 533367cc08..c1b5d70cf8 100644
--- 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenDependencyContextRefiner.java
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenDependencyContextRefiner.java
@@ -37,6 +37,9 @@ import static java.util.Objects.requireNonNull;
  */
 public final class MavenDependencyContextRefiner implements 
DependencyGraphTransformer {
 
+    public MavenDependencyContextRefiner() {}
+
+    @Override
     public DependencyNode transformGraph(DependencyNode node, 
DependencyGraphTransformationContext context)
             throws RepositoryException {
         requireNonNull(node, "node cannot be null");
diff --git 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenDependencyScopes.java
 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenDependencyScopes.java
index fa0fe5b8f7..05d8159e73 100644
--- 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenDependencyScopes.java
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenDependencyScopes.java
@@ -22,15 +22,13 @@ import org.apache.maven.api.DependencyScope;
 
 /**
  * The dependency scopes used for Java dependencies in Maven. This class 
defines labels only, that are doing pass-thru
- * over Resolver.
+ * over Resolver. The labels are defined in {@link DependencyScope} class, 
these are here used only for "easier
+ * reachability" in internal classes.
  *
  * @since 4.0.0
  */
 public final class MavenDependencyScopes {
 
-    /**
-     * Important: keep this label in sync with Resolver.
-     */
     public static final String SYSTEM = DependencyScope.SYSTEM.id();
 
     public static final String NONE = DependencyScope.NONE.id();
diff --git 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenScopeDeriver.java
 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenScopeDeriver.java
index 1664dede1d..20f76a5285 100644
--- 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenScopeDeriver.java
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenScopeDeriver.java
@@ -30,9 +30,6 @@ import 
org.eclipse.aether.util.graph.transformer.ConflictResolver.ScopeDeriver;
  */
 public final class MavenScopeDeriver extends ScopeDeriver {
 
-    /**
-     * Creates a new instance of this scope deriver.
-     */
     public MavenScopeDeriver() {}
 
     @Override
diff --git 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenScopeSelector.java
 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenScopeSelector.java
index 899dae5878..193c1d0375 100644
--- 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenScopeSelector.java
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/scopes/MavenScopeSelector.java
@@ -37,9 +37,6 @@ import 
org.eclipse.aether.util.graph.transformer.ConflictResolver.ScopeSelector;
  */
 public final class MavenScopeSelector extends ScopeSelector {
 
-    /**
-     * Creates a new instance of this scope selector.
-     */
     public MavenScopeSelector() {}
 
     @Override
diff --git 
a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultType.java 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultType.java
similarity index 72%
rename from 
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultType.java
rename to 
maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultType.java
index 9dca04e0ea..d87836bfac 100644
--- a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultType.java
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultType.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.maven.internal.impl;
+package org.apache.maven.repository.internal.type;
 
 import java.util.Collections;
 import java.util.HashMap;
@@ -24,21 +24,25 @@ import java.util.Map;
 
 import org.apache.maven.api.Language;
 import org.apache.maven.api.Type;
+import org.apache.maven.repository.internal.artifact.MavenArtifactProperties;
 import org.eclipse.aether.artifact.ArtifactProperties;
 import org.eclipse.aether.artifact.ArtifactType;
 
-import static org.apache.maven.internal.impl.Utils.nonNull;
+import static java.util.Objects.requireNonNull;
 
+/**
+ * Default implementation of {@link Type} and Resolver {@link ArtifactType}.
+ *
+ * @since 4.0.0
+ */
 public class DefaultType implements Type, ArtifactType {
     private final String id;
-
     private final Language language;
-
     private final String extension;
-
     private final String classifier;
     private final boolean buildPathConstituent;
     private final boolean includesDependencies;
+    private final Map<String, String> properties;
 
     public DefaultType(
             String id,
@@ -47,12 +51,19 @@ public class DefaultType implements Type, ArtifactType {
             String classifier,
             boolean buildPathConstituent,
             boolean includesDependencies) {
-        this.id = nonNull(id, "id");
-        this.language = nonNull(language, "language");
-        this.extension = nonNull(extension, "extension");
+        this.id = requireNonNull(id, "id");
+        this.language = requireNonNull(language, "language");
+        this.extension = requireNonNull(extension, "extension");
         this.classifier = classifier;
         this.buildPathConstituent = buildPathConstituent;
         this.includesDependencies = includesDependencies;
+
+        Map<String, String> properties = new HashMap<>();
+        properties.put(ArtifactProperties.TYPE, id);
+        properties.put(ArtifactProperties.LANGUAGE, language.id());
+        properties.put(MavenArtifactProperties.INCLUDES_DEPENDENCIES, 
Boolean.toString(includesDependencies));
+        properties.put(MavenArtifactProperties.CONSTITUTES_BUILD_PATH, 
Boolean.toString(buildPathConstituent));
+        this.properties = Collections.unmodifiableMap(properties);
     }
 
     @Override
@@ -92,11 +103,6 @@ public class DefaultType implements Type, ArtifactType {
 
     @Override
     public Map<String, String> getProperties() {
-        Map<String, String> properties = new HashMap<>();
-        properties.put(ArtifactProperties.TYPE, this.id);
-        properties.put(ArtifactProperties.LANGUAGE, this.language.id());
-        properties.put(ArtifactProperties.INCLUDES_DEPENDENCIES, 
String.valueOf(includesDependencies));
-        properties.put(ArtifactProperties.CONSTITUTES_BUILD_PATH, 
String.valueOf(buildPathConstituent));
-        return Collections.unmodifiableMap(properties);
+        return properties;
     }
 }
diff --git 
a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultTypeProvider.java
 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultTypeProvider.java
new file mode 100644
index 0000000000..2172fce0bb
--- /dev/null
+++ 
b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultTypeProvider.java
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+package org.apache.maven.repository.internal.type;
+
+import javax.inject.Named;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.maven.api.Language;
+import org.apache.maven.api.Type;
+import org.apache.maven.api.spi.TypeProvider;
+
+@Named
+public class DefaultTypeProvider implements TypeProvider {
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    @Override
+    public Collection<Type> provides() {
+        return (Collection) types();
+    }
+
+    public Collection<DefaultType> types() {
+        return Arrays.asList(
+                new DefaultType("bom", Language.NONE, "pom", null, false, 
false),
+                new DefaultType("pom", Language.NONE, "pom", null, false, 
false),
+                new DefaultType("maven-plugin", Language.JAVA_FAMILY, "jar", 
null, true, false),
+                new DefaultType("jar", Language.JAVA_FAMILY, "jar", null, 
true, false),
+                new DefaultType("ejb", Language.JAVA_FAMILY, "jar", null, 
true, false),
+                new DefaultType("ejb-client", Language.JAVA_FAMILY, "jar", 
"client", true, false),
+                new DefaultType("test-jar", Language.JAVA_FAMILY, "jar", 
"tests", true, false),
+                new DefaultType("javadoc", Language.JAVA_FAMILY, "jar", 
"javadoc", true, false),
+                new DefaultType("java-source", Language.JAVA_FAMILY, "jar", 
"sources", false, false),
+                new DefaultType("war", Language.JAVA_FAMILY, "war", null, 
false, true),
+                new DefaultType("ear", Language.JAVA_FAMILY, "ear", null, 
false, true),
+                new DefaultType("rar", Language.JAVA_FAMILY, "rar", null, 
false, true),
+                new DefaultType("par", Language.JAVA_FAMILY, "par", null, 
false, true));
+    }
+}

Reply via email to