You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/11/08 00:33:02 UTC

[GitHub] [maven-dependency-tree] olamy opened a new pull request, #28: [MSHARED-1158] make DependencyCollectorBuilder nore configurable

olamy opened a new pull request, #28:
URL: https://github.com/apache/maven-dependency-tree/pull/28

   - [SHARED-1158] DependencyCollectorBuilder should be more configurable
   - magnify javadoc and add @since
   
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/projects/MSHARED) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[MSHARED-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MSHARED-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-dependency-tree] olamy merged pull request #28: [MSHARED-1158] make DependencyCollectorBuilder nore configurable

Posted by GitBox <gi...@apache.org>.
olamy merged PR #28:
URL: https://github.com/apache/maven-dependency-tree/pull/28


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-dependency-tree] olamy commented on pull request #28: [MSHARED-1158] make DependencyCollectorBuilder nore configurable

Posted by GitBox <gi...@apache.org>.
olamy commented on PR #28:
URL: https://github.com/apache/maven-dependency-tree/pull/28#issuecomment-1306899354

   > I think that we build `Repository System Session` from scratch here ... can we use prepared session by Maven ... in `org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory#newRepositorySession`
   > 
   > It is to investigate ... 
   
   Yup but should be part of another change?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-dependency-tree] olamy commented on a diff in pull request #28: [MSHARED-1158] make DependencyCollectorBuilder nore configurable

Posted by GitBox <gi...@apache.org>.
olamy commented on code in PR #28:
URL: https://github.com/apache/maven-dependency-tree/pull/28#discussion_r1016346974


##########
src/main/java/org/apache/maven/shared/dependency/graph/DependencyCollectorRequest.java:
##########
@@ -0,0 +1,162 @@
+package org.apache.maven.shared.dependency.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.dependency.graph.internal.DirectScopeDependencySelector;
+import org.apache.maven.shared.dependency.graph.internal.VerboseJavaScopeSelector;
+import org.eclipse.aether.collection.DependencyGraphTransformer;
+import org.eclipse.aether.collection.DependencySelector;
+import org.eclipse.aether.util.artifact.JavaScopes;
+import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
+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.transformer.ConflictResolver;
+import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver;
+import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
+import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * <div>
+ * This class will carry various options used by
+ * {@link DependencyCollectorBuilder#collectDependencyGraph(DependencyCollectorRequest)}
+ * </div>
+ * <div>
+ * There is a set of default values such:
+ * </div>
+ * <div>
+ * DependencySelector
+ * <pre>
+ *  new AndDependencySelector(
+ *             new DirectScopeDependencySelector( JavaScopes.TEST ),
+ *             new DirectScopeDependencySelector( JavaScopes.PROVIDED ),
+ *             new OptionalDependencySelector(),
+ *             new ExclusionDependencySelector() );
+ * </pre>
+ * </div>
+ * <div>
+ * DependencyGraphTransformer
+ * <pre>
+ * new ConflictResolver(
+ *             new NearestVersionSelector(),
+ *             new VerboseJavaScopeSelector(),
+ *             new SimpleOptionalitySelector(),
+ *             new JavaScopeDeriver() );
+ * </pre>
+ * </div>
+ * <div>
+ * configProperties have 2 default values
+ * <pre>
+ *   ConflictResolver.CONFIG_PROP_VERBOSE, true
+ *   DependencyManagerUtils.CONFIG_PROP_VERBOSE, true
+ * </pre>

Review Comment:
   Good idea!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-dependency-tree] slawekjaranowski commented on a diff in pull request #28: [MSHARED-1158] make DependencyCollectorBuilder nore configurable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on code in PR #28:
URL: https://github.com/apache/maven-dependency-tree/pull/28#discussion_r1016269149


##########
src/main/java/org/apache/maven/shared/dependency/graph/DependencyCollectorRequest.java:
##########
@@ -0,0 +1,162 @@
+package org.apache.maven.shared.dependency.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.dependency.graph.internal.DirectScopeDependencySelector;
+import org.apache.maven.shared.dependency.graph.internal.VerboseJavaScopeSelector;
+import org.eclipse.aether.collection.DependencyGraphTransformer;
+import org.eclipse.aether.collection.DependencySelector;
+import org.eclipse.aether.util.artifact.JavaScopes;
+import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
+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.transformer.ConflictResolver;
+import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver;
+import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
+import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * <div>
+ * This class will carry various options used by
+ * {@link DependencyCollectorBuilder#collectDependencyGraph(DependencyCollectorRequest)}
+ * </div>
+ * <div>
+ * There is a set of default values such:
+ * </div>
+ * <div>
+ * DependencySelector
+ * <pre>
+ *  new AndDependencySelector(
+ *             new DirectScopeDependencySelector( JavaScopes.TEST ),
+ *             new DirectScopeDependencySelector( JavaScopes.PROVIDED ),
+ *             new OptionalDependencySelector(),
+ *             new ExclusionDependencySelector() );
+ * </pre>
+ * </div>
+ * <div>
+ * DependencyGraphTransformer
+ * <pre>
+ * new ConflictResolver(
+ *             new NearestVersionSelector(),
+ *             new VerboseJavaScopeSelector(),
+ *             new SimpleOptionalitySelector(),
+ *             new JavaScopeDeriver() );
+ * </pre>
+ * </div>
+ * <div>
+ * configProperties have 2 default values
+ * <pre>
+ *   ConflictResolver.CONFIG_PROP_VERBOSE, true
+ *   DependencyManagerUtils.CONFIG_PROP_VERBOSE, true
+ * </pre>

Review Comment:
   I assume that we mention properties for resolver configuration, maybe will be good idea put a link to
   https://maven.apache.org/resolver/configuration.html



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-dependency-tree] olamy commented on a diff in pull request #28: [MSHARED-1158] make DependencyCollectorBuilder nore configurable

Posted by GitBox <gi...@apache.org>.
olamy commented on code in PR #28:
URL: https://github.com/apache/maven-dependency-tree/pull/28#discussion_r1016495833


##########
src/main/java/org/apache/maven/shared/dependency/graph/DependencyCollectorRequest.java:
##########
@@ -0,0 +1,162 @@
+package org.apache.maven.shared.dependency.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.dependency.graph.internal.DirectScopeDependencySelector;
+import org.apache.maven.shared.dependency.graph.internal.VerboseJavaScopeSelector;
+import org.eclipse.aether.collection.DependencyGraphTransformer;
+import org.eclipse.aether.collection.DependencySelector;
+import org.eclipse.aether.util.artifact.JavaScopes;
+import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
+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.transformer.ConflictResolver;
+import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver;
+import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
+import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * <div>
+ * This class will carry various options used by
+ * {@link DependencyCollectorBuilder#collectDependencyGraph(DependencyCollectorRequest)}
+ * </div>
+ * <div>
+ * There is a set of default values such:
+ * </div>
+ * <div>
+ * DependencySelector
+ * <pre>
+ *  new AndDependencySelector(
+ *             new DirectScopeDependencySelector( JavaScopes.TEST ),
+ *             new DirectScopeDependencySelector( JavaScopes.PROVIDED ),
+ *             new OptionalDependencySelector(),
+ *             new ExclusionDependencySelector() );
+ * </pre>
+ * </div>
+ * <div>
+ * DependencyGraphTransformer
+ * <pre>
+ * new ConflictResolver(
+ *             new NearestVersionSelector(),
+ *             new VerboseJavaScopeSelector(),
+ *             new SimpleOptionalitySelector(),
+ *             new JavaScopeDeriver() );
+ * </pre>
+ * </div>
+ * <div>
+ * configProperties have 2 default values
+ * <pre>
+ *   ConflictResolver.CONFIG_PROP_VERBOSE, true
+ *   DependencyManagerUtils.CONFIG_PROP_VERBOSE, true
+ * </pre>

Review Comment:
   done in 8f4c9f63bf985d858e5e11456f612e9479d561cc 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-dependency-tree] olamy commented on a diff in pull request #28: [MSHARED-1158] make DependencyCollectorBuilder nore configurable

Posted by GitBox <gi...@apache.org>.
olamy commented on code in PR #28:
URL: https://github.com/apache/maven-dependency-tree/pull/28#discussion_r1016031536


##########
src/main/java/org/apache/maven/shared/dependency/graph/DependencyCollectorRequest.java:
##########
@@ -0,0 +1,162 @@
+package org.apache.maven.shared.dependency.graph;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.shared.dependency.graph.internal.DirectScopeDependencySelector;
+import org.apache.maven.shared.dependency.graph.internal.VerboseJavaScopeSelector;
+import org.eclipse.aether.collection.DependencyGraphTransformer;
+import org.eclipse.aether.collection.DependencySelector;
+import org.eclipse.aether.util.artifact.JavaScopes;
+import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
+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.transformer.ConflictResolver;
+import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver;
+import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
+import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * <div>
+ * This class will carry various options used by
+ * {@link DependencyCollectorBuilder#collectDependencyGraph(DependencyCollectorRequest)}
+ * </div>
+ * <div>
+ * There is a set of default values such:
+ * </div>
+ * <div>
+ * DependencySelector
+ * <pre>
+ *  new AndDependencySelector(
+ *             new DirectScopeDependencySelector( JavaScopes.TEST ),
+ *             new DirectScopeDependencySelector( JavaScopes.PROVIDED ),
+ *             new OptionalDependencySelector(),
+ *             new ExclusionDependencySelector() );
+ * </pre>
+ * </div>
+ * <div>
+ * DependencyGraphTransformer
+ * <pre>
+ * new ConflictResolver(
+ *             new NearestVersionSelector(),
+ *             new VerboseJavaScopeSelector(),
+ *             new SimpleOptionalitySelector(),
+ *             new JavaScopeDeriver() );
+ * </pre>
+ * </div>
+ * <div>
+ * configProperties have 2 default values
+ * <pre>
+ *   ConflictResolver.CONFIG_PROP_VERBOSE, true
+ *   DependencyManagerUtils.CONFIG_PROP_VERBOSE, true
+ * </pre>
+ *
+ * </div>
+ * @since 3.2.1
+ */
+public class DependencyCollectorRequest
+{
+
+    private final ProjectBuildingRequest buildingRequest;
+
+    private ArtifactFilter filter;
+
+    private Map<String, Object> configProperties = new HashMap<>();
+
+    private DependencySelector dependencySelector = new AndDependencySelector(
+            new DirectScopeDependencySelector( JavaScopes.TEST ),
+            new DirectScopeDependencySelector( JavaScopes.PROVIDED ),
+            new OptionalDependencySelector(),
+            new ExclusionDependencySelector() );

Review Comment:
   well TBH this empty ExclusionDependencySelector doesn't have any effect. we could simply remove it and the code not will not pass tru to do nothing :) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org