Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MENFORCER-452] Manage all Maven Core dependencies as provided #206

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions enforcer-rules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,10 @@
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
<version>1.1.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-util</artifactId>
<version>1.1.0</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.enforcer.rule.api.EnforcerRule;
import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
Expand Down Expand Up @@ -107,7 +107,7 @@ private static boolean searchTree(

if ((excluded || hasTransitiveDependencies) && message != null) // then generate message
{
message.append(Strings.repeat(" ", level)).append(node.getArtifact());
message.append(StringUtils.repeat(" ", level)).append(node.getArtifact());

if (excluded) {
message.append(" [excluded]").append(System.lineSeparator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import java.util.List;

import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
Expand Down Expand Up @@ -105,7 +105,7 @@ protected boolean validate(DependencyNode node, int level, StringBuilder message
.map(childNode -> validate(childNode, level + 1, childMessageBuilder))
.reduce(true, Boolean::logicalAnd)) {
messageBuilder
.append(Strings.repeat(" ", level))
.append(StringUtils.repeat(" ", level))
.append(ArtifactUtils.toArtifact(node).getId());
if (rootFailed) {
messageBuilder.append(" <--- ").append(getErrorMessage());
Expand Down
15 changes: 3 additions & 12 deletions maven-enforcer-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,13 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<!-- needed for IT tests -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
</dependencies>

Expand All @@ -61,23 +55,20 @@
<profiles>
<profile>
<id>run-its</id>
<properties>
<maven.it.failure.ignore>false</maven.it.failure.ignore>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<showErrors>true</showErrors>
<debug>true</debug>
<projectsDirectory>src/it/projects</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<preBuildHookScript>setup</preBuildHookScript>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/mrm/settings.xml</settingsFile>
<ignoreFailures>${maven.it.failure.ignore}</ignoreFailures>
<goals>
<goal>validate</goal>
</goals>
Expand Down
6 changes: 0 additions & 6 deletions maven-enforcer-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
Expand Down Expand Up @@ -141,9 +139,6 @@
<profiles>
<profile>
<id>run-its</id>
<properties>
<maven.it.failure.ignore>false</maven.it.failure.ignore>
</properties>
<build>
<plugins>
<plugin>
Expand All @@ -157,7 +152,6 @@
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/mrm/settings.xml</settingsFile>
<ignoreFailures>${maven.it.failure.ignore}</ignoreFailures>
<goals>
<goal>validate</goal>
</goals>
Expand Down
62 changes: 40 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@
<javaVersion>8</javaVersion>
<mockito.version>4.10.0</mockito.version>
<project.build.outputTimestamp>2022-12-22T22:11:45Z</project.build.outputTimestamp>
<!-- the same as Maven 3.2.5 -->
<aether.version>1.0.0.v20140518</aether.version>
</properties>

<dependencyManagement>
<dependencies>
<!-- project dependencies -->
<dependency>
<groupId>org.apache.maven.enforcer</groupId>
<artifactId>enforcer-api</artifactId>
Expand All @@ -103,31 +106,66 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>

<!-- Maven Core dependencies -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
<version>${aether.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-util</artifactId>
<version>${aether.version}</version>
</dependency>

<!-- other dependencies -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-common-artifact-filters</artifactId>
<version>3.3.2</version>
<artifactId>maven-shared-utils</artifactId>
<version>3.3.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.5.0</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
Expand All @@ -147,21 +185,6 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
Expand All @@ -174,11 +197,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.3.4</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down