Skip to content

Commit

Permalink
Merge branch 'apache:master' into advanced-dep-convergence
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-anufriev authored Mar 6, 2023
2 parents 54c1738 + 6b62f03 commit 5075b26
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ on:
- master
jobs:
update_release_draft:
uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v2
uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v3
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@
import org.eclipse.aether.graph.DependencyNode;
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.selector.ScopeDependencySelector;
import org.eclipse.aether.util.graph.transformer.ConflictResolver;

import static java.util.Optional.ofNullable;
import static org.apache.maven.artifact.Artifact.SCOPE_PROVIDED;
import static org.apache.maven.artifact.Artifact.SCOPE_TEST;

/**
* Resolver helper class.
Expand Down Expand Up @@ -70,6 +75,13 @@ class ResolveUtil {
* @throws EnforcerRuleException thrown if the lookup fails
*/
DependencyNode resolveTransitiveDependencies(DependencySelector... selectors) throws EnforcerRuleException {
if (selectors.length == 0) {
selectors = new DependencySelector[] {
new ScopeDependencySelector(SCOPE_TEST, SCOPE_PROVIDED),
new OptionalDependencySelector(),
new ExclusionDependencySelector()
};
}
try {
MavenProject project = session.getCurrentProject();
ArtifactTypeRegistry artifactTypeRegistry =
Expand All @@ -79,9 +91,7 @@ DependencyNode resolveTransitiveDependencies(DependencySelector... selectors) th
new DefaultRepositorySystemSession(session.getRepositorySession());
repositorySystemSession.setConfigProperty(ConflictResolver.CONFIG_PROP_VERBOSE, true);
repositorySystemSession.setConfigProperty(DependencyManagerUtils.CONFIG_PROP_VERBOSE, true);
if (selectors.length > 0) {
repositorySystemSession.setDependencySelector(new AndDependencySelector(selectors));
}
repositorySystemSession.setDependencySelector(new AndDependencySelector(selectors));

CollectRequest collectRequest = new CollectRequest(
project.getDependencies().stream()
Expand Down
6 changes: 3 additions & 3 deletions enforcer-rules/src/site/apt/banDynamicVersions.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

Ban Dynamic Versions

This rule bans dependencies having versions which require resolving (i.e. dynamic versions which might change with each build and require
lookup of {{{https://maven.apache.org/ref/3-LATEST/maven-repository-metadata/repository-metadata.html}repositoy metadata}}). Dynamic versions are either
This rule bans dependencies having versions that require resolving (i.e. dynamic versions which might change with each build and require
lookup of {{{https://maven.apache.org/ref/3-LATEST/maven-repository-metadata/repository-metadata.html}repository metadata}}). Dynamic versions are either

* {{{https://maven.apache.org/pom.html#Dependency_Version_Requirement_Specification}version ranges}}, i.e. all version strings starting with either <<<[>>> or <<<(>>>,

Expand Down Expand Up @@ -93,7 +93,7 @@ Ban Dynamic Versions
<banDynamicVersions>
<ignores>
<ignore>org.apache.maven</ignore>
</ignore>
</ignores>
<allowSnapshots>true</allowSnapshots>
</banDynamicVersions>
</rules>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

invoker.buildResult = success
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
*
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugins.enforcer.its</groupId>
<artifactId>menforcer128</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins.enforcer.its</groupId>
<artifactId>menforcer128_api</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<RequireUpperBoundDeps/>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 5075b26

Please sign in to comment.