From 302d9ee103aa9e34fc41240c4bb49f87920b3ad4 Mon Sep 17 00:00:00 2001
From: Tamas Cservenak <tamas@cservenak.net>
Date: Mon, 12 Feb 2024 15:43:28 +0100
Subject: [PATCH 1/3] [MRESOLVER-480] Document latest changes

Those that may affect consumer projects.

---

https://issues.apache.org/jira/browse/MRESOLVER-480
---
 src/site/markdown/upgrading-resolver.md | 27 ++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/site/markdown/upgrading-resolver.md b/src/site/markdown/upgrading-resolver.md
index a76b6bc3b..df85ad730 100644
--- a/src/site/markdown/upgrading-resolver.md
+++ b/src/site/markdown/upgrading-resolver.md
@@ -19,13 +19,13 @@
 This page will collect quick guides for developers upgrading from one to
 another major version of Resolver.
 
-# Upgrading from 1.x to 2.x
+# Upgrading From 1.x to 2.x
 
 Maven Resolver upcoming major version 2.x should be "smooth sailing", as long you
 do not depend (directly or indirectly) on **deprecated** classes from Resolver
 1.x line. Always use latest 1.x release to check for deprecated classes.
 
-## Session handling changes
+## Session Handling Changes
 
 Maven Resolver 2.x introduced "onSessionEnd" hooks, that became required for
 some of the new features (like HTTP/2 transports are). While existing "Resolver 1.x"
@@ -40,10 +40,31 @@ What changed on surface:
 * introduction of `RepositorySystem` new method `createSessionBuilder` that creates `SessionBuilder` instances.
 * deprecation of `DefaultRepositorySystemSession` default constructor, this constructor is actually the "Resolver 1.x way" of using sessions.
 
-Required changes in **client code managing Resolver 2.x**:
+Required changes in **consumer project code managing Resolver 2.x**:
 * do not use `DefaultRepositorySystemSession` default constructor anymore.
 * instead, use `RepositorySystem#createSessionBuilder` to create `SessionBuilder` and out of it `CloseableSession` instances.
 * handle sessions as resources: each created instance should be closed once finished their use.
 * session instances created by given `RepositorySystem` should be used only with that same instance.
 * to shallow-copy session instances (for alteration purposes) using existing `DefaultRepositorySystemSession` copy constructor is acceptable (this is what Mojos do).
 * to shallow-copy session instances but have new lifecycle as well, use `SessionBuilder#withRepositorySystemSession` on newly created builder instances.
+
+## Consumer Project Changes (if more needed)
+
+Maven Resolver 2.x now delegates multiple aspects fully to consumer project, itself remaining "oblivious" about
+them. This was done to lessen (or better, fully remove) any overlap of logic between Resolver, and it's major
+consumer project: Maven. The following aspects are fully delegated to consumer projects:
+* Most of the `ArtifactProperties` is deprecated (sans two "core" ones: type and language), as it is really matter of consumer project assign semantics to them.
+* The `ArtifactType` default implementation is deprecated, should be provided by consumer project instead, Resolver 2.x does not provide implementations for it.
+* Class path generation (in NodeListGenerator class variations in `org.eclipse.aether.util.graph.visitor` package) and class path filtering (in `DependencyFilterUtils`) is deprecated. It is consumer app, based on own artifact properties, that can really deduce how to build class path (or module path, or anything alike).
+* Dependency Scopes are fully removed. For Resolver, they were always "just labels". Resolver is now fully unaware of scopes (and for "system" artifacts has a dedicated handler exposed on session).
+
+For users of Maven Resolver Provider module, these changes will be fully transparent, as all the replacements for 
+items from the list above are moved to `org.apache.maven:maven-resolver-provider` module. Still, for binary 
+compatibility, almost all affected classes are left in place, but deprecated. Consumer projects should update 
+accordingly, and if they do use any of deprecated classes from resolver (affected modules are maven-resolver-api 
+and maven-resolver-util), they should switch to their counterparts, that are now present in maven-resolver-provider 
+module.
+
+Note: Resolver 2.x still fully supports "legacy" (Maven3-like) functionality, and if existing consumer
+code base adapts only the session related changes, consumer project can enjoy new features (like HTTP/2 transport),
+while keep full compatibility, identical to Resolver 1.x release.

From da9b26ecde7465072a432e757e5af2f1fc42e7e0 Mon Sep 17 00:00:00 2001
From: Tamas Cservenak <tamas@cservenak.net>
Date: Mon, 12 Feb 2024 15:53:20 +0100
Subject: [PATCH 2/3] Remove class introduced in alpha-7 but deprecated as we
 removed all scopes from resolver

---
 .../util/artifact/DependencyScopes.java       | 50 -------------------
 .../aether/util/artifact/JavaScopes.java      |  6 +--
 .../JavaDependencyContextRefiner.java         |  5 +-
 .../graph/transformer/JavaScopeDeriver.java   |  5 +-
 .../graph/transformer/JavaScopeSelector.java  |  5 +-
 src/site/markdown/upgrading-resolver.md       | 12 ++---
 6 files changed, 11 insertions(+), 72 deletions(-)
 delete mode 100644 maven-resolver-util/src/main/java/org/eclipse/aether/util/artifact/DependencyScopes.java

diff --git a/maven-resolver-util/src/main/java/org/eclipse/aether/util/artifact/DependencyScopes.java b/maven-resolver-util/src/main/java/org/eclipse/aether/util/artifact/DependencyScopes.java
deleted file mode 100644
index d53257bd7..000000000
--- a/maven-resolver-util/src/main/java/org/eclipse/aether/util/artifact/DependencyScopes.java
+++ /dev/null
@@ -1,50 +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.eclipse.aether.util.artifact;
-
-/**
- * The dependency scopes that Resolver supports out of the box. The full set of scopes should be defined by
- * consumer project.
- * <p>
- * By definition, scopes for Resolver are just labels, checked for equality. Resolver will not interpret, alter or
- * modify any scope "label" that is not present in this class. It is left to consumer projects to define and
- * interpret those.
- *
- * @see org.eclipse.aether.graph.Dependency#getScope()
- * @since 2.0.0
- * @deprecated Consumer project is defining scopes.
- */
-@Deprecated
-public final class DependencyScopes {
-
-    /**
-     * Special scope that tells resolver that dependency is not to be found in any regular repository, so it should not
-     * even try to resolve the artifact from them. Dependency in this scope does not have artifact descriptor either.
-     * Artifacts in this scope should have the "local path" property set, pointing to a file on local system, where the
-     * backing file should reside. Resolution of artifacts in this scope fails, if backing file does not exist
-     * (no property set, or property contains invalid path, or the path points to a non-existent file).
-     *
-     * @see org.eclipse.aether.artifact.ArtifactProperties#LOCAL_PATH
-     */
-    public static final String SYSTEM = "system";
-
-    private DependencyScopes() {
-        // hide constructor
-    }
-}
diff --git a/maven-resolver-util/src/main/java/org/eclipse/aether/util/artifact/JavaScopes.java b/maven-resolver-util/src/main/java/org/eclipse/aether/util/artifact/JavaScopes.java
index 43915f1fe..be26af874 100644
--- a/maven-resolver-util/src/main/java/org/eclipse/aether/util/artifact/JavaScopes.java
+++ b/maven-resolver-util/src/main/java/org/eclipse/aether/util/artifact/JavaScopes.java
@@ -23,9 +23,7 @@
  *
  * @see org.eclipse.aether.graph.Dependency#getScope()
  *
- * @deprecated Definition and semantics of the scopes should be defined by consumer project. Resolver out-of-the-box
- * supported scopes are defined in {@link DependencyScopes} class. Resolver is oblivious about any other scopes and their
- * semantics.
+ * @deprecated Definition and semantics of the scopes should be defined by consumer project.
  */
 @Deprecated
 public final class JavaScopes {
@@ -34,7 +32,7 @@ public final class JavaScopes {
 
     public static final String PROVIDED = "provided";
 
-    public static final String SYSTEM = DependencyScopes.SYSTEM;
+    public static final String SYSTEM = "system";
 
     public static final String RUNTIME = "runtime";
 
diff --git a/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaDependencyContextRefiner.java b/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaDependencyContextRefiner.java
index 1d04bc3b3..a9c1e84a1 100644
--- a/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaDependencyContextRefiner.java
+++ b/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaDependencyContextRefiner.java
@@ -23,7 +23,6 @@
 import org.eclipse.aether.collection.DependencyGraphTransformer;
 import org.eclipse.aether.graph.Dependency;
 import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.util.artifact.DependencyScopes;
 import org.eclipse.aether.util.artifact.JavaScopes;
 
 import static java.util.Objects.requireNonNull;
@@ -35,9 +34,7 @@
  *
  * @see DependencyNode#getRequestContext()
  *
- * @deprecated This class belongs to consumer project. Resolver have no notion of scopes other than those defined
- * in {@link DependencyScopes} class, moreover it has no knowledge about scope transformation
- * of dependencies to build path scopes.
+ * @deprecated This class belongs to consumer project. Resolver should have no notion of scopes.
  */
 @Deprecated
 public final class JavaDependencyContextRefiner implements DependencyGraphTransformer {
diff --git a/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaScopeDeriver.java b/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaScopeDeriver.java
index e4324ca2d..f4b980634 100644
--- a/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaScopeDeriver.java
+++ b/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaScopeDeriver.java
@@ -19,7 +19,6 @@
 package org.eclipse.aether.util.graph.transformer;
 
 import org.eclipse.aether.RepositoryException;
-import org.eclipse.aether.util.artifact.DependencyScopes;
 import org.eclipse.aether.util.artifact.JavaScopes;
 import org.eclipse.aether.util.graph.transformer.ConflictResolver.ScopeContext;
 import org.eclipse.aether.util.graph.transformer.ConflictResolver.ScopeDeriver;
@@ -27,9 +26,7 @@
 /**
  * A scope deriver for use with {@link ConflictResolver} that supports the scopes from {@link JavaScopes}.
  *
- * @deprecated This class belongs to consumer project. Resolver have no notion of scopes other than those defined
- * in {@link DependencyScopes} class, moreover it has no knowledge about scope transformation
- * of dependencies to build path scopes.
+ * @deprecated This class belongs to consumer project. Resolver should have no notion of scopes.
  */
 @Deprecated
 public final class JavaScopeDeriver extends ScopeDeriver {
diff --git a/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaScopeSelector.java b/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaScopeSelector.java
index 416614c77..37d2eb3ab 100644
--- a/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaScopeSelector.java
+++ b/maven-resolver-util/src/main/java/org/eclipse/aether/util/graph/transformer/JavaScopeSelector.java
@@ -23,7 +23,6 @@
 import java.util.Set;
 
 import org.eclipse.aether.RepositoryException;
-import org.eclipse.aether.util.artifact.DependencyScopes;
 import org.eclipse.aether.util.artifact.JavaScopes;
 import org.eclipse.aether.util.graph.transformer.ConflictResolver.ConflictContext;
 import org.eclipse.aether.util.graph.transformer.ConflictResolver.ConflictItem;
@@ -34,9 +33,7 @@
  * this selector picks the widest scope present among conflicting dependencies where e.g. "compile" is wider than
  * "runtime" which is wider than "test". If however a direct dependency is involved, its scope is selected.
  *
- * @deprecated This class belongs to consumer project. Resolver have no notion of scopes other than those defined
- * in {@link DependencyScopes} class, moreover it has no knowledge about scope transformation
- * of dependencies to build path scopes.
+ * @deprecated This class belongs to consumer project. Resolver should have no notion of scopes.
  */
 @Deprecated
 public final class JavaScopeSelector extends ScopeSelector {
diff --git a/src/site/markdown/upgrading-resolver.md b/src/site/markdown/upgrading-resolver.md
index df85ad730..84b13474d 100644
--- a/src/site/markdown/upgrading-resolver.md
+++ b/src/site/markdown/upgrading-resolver.md
@@ -53,14 +53,14 @@ Required changes in **consumer project code managing Resolver 2.x**:
 Maven Resolver 2.x now delegates multiple aspects fully to consumer project, itself remaining "oblivious" about
 them. This was done to lessen (or better, fully remove) any overlap of logic between Resolver, and it's major
 consumer project: Maven. The following aspects are fully delegated to consumer projects:
-* Most of the `ArtifactProperties` is deprecated (sans two "core" ones: type and language), as it is really matter of consumer project assign semantics to them.
-* The `ArtifactType` default implementation is deprecated, should be provided by consumer project instead, Resolver 2.x does not provide implementations for it.
-* Class path generation (in NodeListGenerator class variations in `org.eclipse.aether.util.graph.visitor` package) and class path filtering (in `DependencyFilterUtils`) is deprecated. It is consumer app, based on own artifact properties, that can really deduce how to build class path (or module path, or anything alike).
+* Most of the `ArtifactProperties` is deprecated (sans two "core" ones: type and language), as it is really matter of the consumer project assign semantics to them.
+* The `ArtifactType` default implementation is deprecated, should be provided by consumer project instead, Resolver 2.x should not provide implementations for it.
+* Class path generation (in NodeListGenerator class variations in `org.eclipse.aether.util.graph.visitor` package) and class path filtering (in `DependencyFilterUtils`) is deprecated. It is the consumer app, based on own artifact properties, that can deduce how to build class path (or module path, or anything alike).
 * Dependency Scopes are fully removed. For Resolver, they were always "just labels". Resolver is now fully unaware of scopes (and for "system" artifacts has a dedicated handler exposed on session).
 
-For users of Maven Resolver Provider module, these changes will be fully transparent, as all the replacements for 
-items from the list above are moved to `org.apache.maven:maven-resolver-provider` module. Still, for binary 
-compatibility, almost all affected classes are left in place, but deprecated. Consumer projects should update 
+For users of Maven Resolver Provider module, these changes will have clean migration path, as all the replacements for 
+items from the list above are present in `org.apache.maven:maven-resolver-provider` module. Still, for binary 
+compatibility, all affected classes are in fact left in place, but deprecated. Consumer projects should update 
 accordingly, and if they do use any of deprecated classes from resolver (affected modules are maven-resolver-api 
 and maven-resolver-util), they should switch to their counterparts, that are now present in maven-resolver-provider 
 module.

From a713a113296c65092bd847aa0f6d179063a6913c Mon Sep 17 00:00:00 2001
From: Tamas Cservenak <tamas@cservenak.net>
Date: Wed, 14 Feb 2024 20:36:10 +0100
Subject: [PATCH 3/3] PR comments

---
 src/site/markdown/upgrading-resolver.md | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/site/markdown/upgrading-resolver.md b/src/site/markdown/upgrading-resolver.md
index 84b13474d..db403f867 100644
--- a/src/site/markdown/upgrading-resolver.md
+++ b/src/site/markdown/upgrading-resolver.md
@@ -19,13 +19,13 @@
 This page will collect quick guides for developers upgrading from one to
 another major version of Resolver.
 
-# Upgrading From 1.x to 2.x
+# Upgrading from 1.x to 2.x
 
 Maven Resolver upcoming major version 2.x should be "smooth sailing", as long you
 do not depend (directly or indirectly) on **deprecated** classes from Resolver
 1.x line. Always use latest 1.x release to check for deprecated classes.
 
-## Session Handling Changes
+## Session handling changes
 
 Maven Resolver 2.x introduced "onSessionEnd" hooks, that became required for
 some of the new features (like HTTP/2 transports are). While existing "Resolver 1.x"
@@ -50,8 +50,8 @@ Required changes in **consumer project code managing Resolver 2.x**:
 
 ## Consumer Project Changes (if more needed)
 
-Maven Resolver 2.x now delegates multiple aspects fully to consumer project, itself remaining "oblivious" about
-them. This was done to lessen (or better, fully remove) any overlap of logic between Resolver, and it's major
+Maven Resolver 2.x now fully delegates multiple aspects to the consumer project, itself remaining "oblivious" about
+them. This was done to lessen (or better, fully remove) any overlap between the logic of the Resolver, and it's major
 consumer project: Maven. The following aspects are fully delegated to consumer projects:
 * Most of the `ArtifactProperties` is deprecated (sans two "core" ones: type and language), as it is really matter of the consumer project assign semantics to them.
 * The `ArtifactType` default implementation is deprecated, should be provided by consumer project instead, Resolver 2.x should not provide implementations for it.
@@ -61,10 +61,10 @@ consumer project: Maven. The following aspects are fully delegated to consumer p
 For users of Maven Resolver Provider module, these changes will have clean migration path, as all the replacements for 
 items from the list above are present in `org.apache.maven:maven-resolver-provider` module. Still, for binary 
 compatibility, all affected classes are in fact left in place, but deprecated. Consumer projects should update 
-accordingly, and if they do use any of deprecated classes from resolver (affected modules are maven-resolver-api 
+accordingly, and if they do use any deprecated classes from the resolver (affected modules are maven-resolver-api 
 and maven-resolver-util), they should switch to their counterparts, that are now present in maven-resolver-provider 
 module.
 
 Note: Resolver 2.x still fully supports "legacy" (Maven3-like) functionality, and if existing consumer
 code base adapts only the session related changes, consumer project can enjoy new features (like HTTP/2 transport),
-while keep full compatibility, identical to Resolver 1.x release.
+while keeping full compatibility, identical to Resolver 1.x release.