You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2024/02/15 16:46:13 UTC

(maven-resolver) branch master updated: [MRESOLVER-480] Document latest changes (#429)

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-resolver.git


The following commit(s) were added to refs/heads/master by this push:
     new 0bfb9aaf [MRESOLVER-480] Document latest changes (#429)
0bfb9aaf is described below

commit 0bfb9aafd9537582185ebbdd44c05fb3db0f552e
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Thu Feb 15 17:46:08 2024 +0100

    [MRESOLVER-480] Document latest changes (#429)
    
    Those that may affect consumer projects.
    
    Also, a small irrelevant (and harmless) change: remove the class `DependencyScopes` that got introduced in alpha-7, but got deprecated while working on alpha-8, where we made Resolver fully scope oblivious.
    
    ---
    
    https://issues.apache.org/jira/browse/MRESOLVER-480
---
 .../aether/util/artifact/DependencyScopes.java     | 50 ----------------------
 .../eclipse/aether/util/artifact/JavaScopes.java   |  6 +--
 .../transformer/JavaDependencyContextRefiner.java  |  5 +--
 .../util/graph/transformer/JavaScopeDeriver.java   |  5 +--
 .../util/graph/transformer/JavaScopeSelector.java  |  5 +--
 src/site/markdown/upgrading-resolver.md            | 23 +++++++++-
 6 files changed, 27 insertions(+), 67 deletions(-)

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 d53257bd..00000000
--- 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 43915f1f..be26af87 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 @@ package org.eclipse.aether.util.artifact;
  *
  * @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 1d04bc3b..a9c1e84a 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.DependencyGraphTransformationContext;
 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 @@ import static java.util.Objects.requireNonNull;
  *
  * @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 e4324ca2..f4b98063 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 @@ import org.eclipse.aether.util.graph.transformer.ConflictResolver.ScopeDeriver;
 /**
  * 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 416614c7..37d2eb3a 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.HashSet;
 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 @@ import org.eclipse.aether.util.graph.transformer.ConflictResolver.ScopeSelector;
  * 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 a76b6bc3..db403f86 100644
--- a/src/site/markdown/upgrading-resolver.md
+++ b/src/site/markdown/upgrading-resolver.md
@@ -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 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.
+* 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 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 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 keeping full compatibility, identical to Resolver 1.x release.