This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git
The following commit(s) were added to refs/heads/master by this push: new 29d1c0d [MENFORCER-497] Require Maven 3.6.3+ 29d1c0d is described below commit 29d1c0d7e07ddb63dd52c07c7d229a78bd3fc5f6 Author: Sylwester Lachiewicz <slachiew...@apache.org> AuthorDate: Sun Feb 11 13:42:12 2024 +0100 [MENFORCER-497] Require Maven 3.6.3+ --- enforcer-rules/pom.xml | 8 +++---- .../src/it/projects/invoker.properties | 1 - .../invoker.properties | 18 --------------- .../invoker.properties | 18 --------------- .../require-plugin-versions-ci/invoker.properties | 3 +-- .../invoker.properties | 25 -------------------- .../invoker.properties | 3 +-- .../invoker.properties | 18 --------------- .../invoker.properties | 1 - .../invoker.properties | 18 --------------- .../invoker.properties | 18 --------------- .../maven/plugins/enforcer/TestEnforceMojo.java | 12 +++++++--- .../enforcer/internal/EnforcerRuleManagerTest.java | 6 ++++- pom.xml | 27 ++++++++-------------- 14 files changed, 30 insertions(+), 146 deletions(-) diff --git a/enforcer-rules/pom.xml b/enforcer-rules/pom.xml index 744c426..b0cd73a 100644 --- a/enforcer-rules/pom.xml +++ b/enforcer-rules/pom.xml @@ -71,12 +71,12 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.eclipse.aether</groupId> - <artifactId>aether-api</artifactId> + <groupId>org.apache.maven.resolver</groupId> + <artifactId>maven-resolver-api</artifactId> </dependency> <dependency> - <groupId>org.eclipse.aether</groupId> - <artifactId>aether-util</artifactId> + <groupId>org.apache.maven.resolver</groupId> + <artifactId>maven-resolver-util</artifactId> </dependency> <dependency> <groupId>org.eclipse.sisu</groupId> diff --git a/maven-enforcer-extension/src/it/projects/invoker.properties b/maven-enforcer-extension/src/it/projects/invoker.properties index 7283777..9bbbd74 100644 --- a/maven-enforcer-extension/src/it/projects/invoker.properties +++ b/maven-enforcer-extension/src/it/projects/invoker.properties @@ -14,7 +14,6 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -invoker.maven.version = 3.3.1+ invoker.goals.1 = validate invoker.goals.2 = verify invoker.buildResult.2 = failure diff --git a/maven-enforcer-plugin/src/it/projects/dependencies_converge_exclude_wildcard/invoker.properties b/maven-enforcer-plugin/src/it/projects/dependencies_converge_exclude_wildcard/invoker.properties deleted file mode 100644 index c4dc6a1..0000000 --- a/maven-enforcer-plugin/src/it/projects/dependencies_converge_exclude_wildcard/invoker.properties +++ /dev/null @@ -1,18 +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. - -invoker.maven.version = 3.6.2+ diff --git a/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/invoker.properties deleted file mode 100644 index 1c82ab6..0000000 --- a/maven-enforcer-plugin/src/it/projects/require-no-repositories_mm_ci/invoker.properties +++ /dev/null @@ -1,18 +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. - -invoker.maven.version = 3.5.0+ \ No newline at end of file diff --git a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/invoker.properties index adc1614..66b78c0 100644 --- a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/invoker.properties +++ b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-ci/invoker.properties @@ -15,5 +15,4 @@ # specific language governing permissions and limitations # under the License. -invoker.maven.version = 3.5.0+ -invoker.buildResult=failure \ No newline at end of file +invoker.buildResult=failure diff --git a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-expressions/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-expressions/invoker.properties deleted file mode 100644 index aa66e8f..0000000 --- a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-expressions/invoker.properties +++ /dev/null @@ -1,25 +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. - -# When running with M2.2.1 Maven already fails to download the pom, so it doesn't even reach the rule. Not sure why MRM can't serve this file, but does with M3 -# -#Caused by: java.io.FileNotFoundException: http://localhost:50910/org/apache/maven/enforcer/its/menforcer126_maven-plugin/1.0/menforcer126_maven-plugin-1.0.pom -# at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1434) -# at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379) -# at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115) -# ... 33 more -invoker.maven.version=3.0+ \ No newline at end of file diff --git a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-mm-ci-friendly/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-mm-ci-friendly/invoker.properties index 1b78093..5705236 100644 --- a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-mm-ci-friendly/invoker.properties +++ b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-mm-ci-friendly/invoker.properties @@ -14,5 +14,4 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -invoker.maven.version = 3.5.0+ -invoker.goals = install -Drevision=0.10.0-SNAPSHOT \ No newline at end of file +invoker.goals = install -Drevision=0.10.0-SNAPSHOT diff --git a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-plugin-with-integration-test-lifecycle/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-plugin-versions-plugin-with-integration-test-lifecycle/invoker.properties deleted file mode 100644 index ff7096b..0000000 --- a/maven-enforcer-plugin/src/it/projects/require-plugin-versions-plugin-with-integration-test-lifecycle/invoker.properties +++ /dev/null @@ -1,18 +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. - -invoker.maven.version=3.0+ \ No newline at end of file diff --git a/maven-enforcer-plugin/src/it/projects/require-snapshot-version_failure_parent-ci-friendly/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-snapshot-version_failure_parent-ci-friendly/invoker.properties index 4d90799..58b6526 100644 --- a/maven-enforcer-plugin/src/it/projects/require-snapshot-version_failure_parent-ci-friendly/invoker.properties +++ b/maven-enforcer-plugin/src/it/projects/require-snapshot-version_failure_parent-ci-friendly/invoker.properties @@ -15,5 +15,4 @@ # specific language governing permissions and limitations # under the License. -invoker.maven.version = 3.5.0+ invoker.buildResult = failure diff --git a/maven-enforcer-plugin/src/it/projects/require-snapshot-version_success_parent-ci-friendly/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-snapshot-version_success_parent-ci-friendly/invoker.properties deleted file mode 100644 index 425ce06..0000000 --- a/maven-enforcer-plugin/src/it/projects/require-snapshot-version_success_parent-ci-friendly/invoker.properties +++ /dev/null @@ -1,18 +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. - -invoker.maven.version = 3.5.0+ diff --git a/maven-enforcer-plugin/src/it/projects/require-upper-bound-exclude_wildcard/invoker.properties b/maven-enforcer-plugin/src/it/projects/require-upper-bound-exclude_wildcard/invoker.properties deleted file mode 100644 index c4dc6a1..0000000 --- a/maven-enforcer-plugin/src/it/projects/require-upper-bound-exclude_wildcard/invoker.properties +++ /dev/null @@ -1,18 +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. - -invoker.maven.version = 3.6.2+ diff --git a/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java b/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java index e51755a..831403e 100644 --- a/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java +++ b/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java @@ -21,6 +21,7 @@ package org.apache.maven.plugins.enforcer; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Properties; import org.apache.maven.enforcer.rule.api.EnforcerLevel; import org.apache.maven.enforcer.rule.api.EnforcerRule; @@ -33,14 +34,13 @@ import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.enforcer.internal.EnforcerRuleDesc; import org.apache.maven.plugins.enforcer.internal.EnforcerRuleManager; import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import org.mockito.junit.jupiter.MockitoSettings; -import org.mockito.quality.Strictness; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -48,6 +48,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -57,7 +58,6 @@ import static org.mockito.Mockito.when; * @author <a href="mailto:bri...@apache.org">Brian Fox</a> */ @ExtendWith(MockitoExtension.class) -@MockitoSettings(strictness = Strictness.LENIENT) class TestEnforceMojo { @Mock @@ -69,6 +69,12 @@ class TestEnforceMojo { @InjectMocks private EnforceMojo mojo; + @BeforeEach + void setup() { + lenient().when(session.getSystemProperties()).thenReturn(new Properties()); + lenient().when(session.getUserProperties()).thenReturn(new Properties()); + } + @Test void emptyRuleListShouldThrowException() { mojo.setFail(false); diff --git a/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/internal/EnforcerRuleManagerTest.java b/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/internal/EnforcerRuleManagerTest.java index 106d7ed..6799d8c 100644 --- a/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/internal/EnforcerRuleManagerTest.java +++ b/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/internal/EnforcerRuleManagerTest.java @@ -21,6 +21,7 @@ package org.apache.maven.plugins.enforcer.internal; import javax.inject.Provider; import java.util.List; +import java.util.Properties; import org.apache.maven.enforcer.rule.api.EnforcerLevel; import org.apache.maven.enforcer.rule.api.EnforcerRuleBase; @@ -94,7 +95,10 @@ class EnforcerRuleManagerTest { when(mojoDescriptor.getPluginDescriptor()).thenReturn(mock(PluginDescriptor.class)); - when(sessionProvider.get()).thenReturn(mock(MavenSession.class)); + MavenSession mavenSession = mock(MavenSession.class); + when(mavenSession.getSystemProperties()).thenReturn(new Properties()); + when(mavenSession.getUserProperties()).thenReturn(new Properties()); + when(sessionProvider.get()).thenReturn(mavenSession); when(plexusContainer.hasComponent(any(Class.class), anyString())).thenReturn(hasComponent); } diff --git a/pom.xml b/pom.xml index 9678a2b..929a3f3 100644 --- a/pom.xml +++ b/pom.xml @@ -77,13 +77,13 @@ </distributionManagement> <properties> - <mavenVersion>3.2.5</mavenVersion> + <mavenVersion>3.6.3</mavenVersion> <maven.site.path>enforcer-archives/enforcer-LATEST</maven.site.path> <javaVersion>8</javaVersion> <mockito.version>4.11.0</mockito.version> - <project.build.outputTimestamp>2024-05-26T08:52:43Z</project.build.outputTimestamp> - <!-- the same as Maven 3.2.5 --> - <aether.version>1.0.0.v20140518</aether.version> + <project.build.outputTimestamp>2023-09-07T17:27:52Z</project.build.outputTimestamp> + <!-- the same as Maven 3.6.3 --> + <resolver.version>1.4.1</resolver.version> <!-- plugins used in IT, not defined in parent --> <version.maven-pmd-plugin>3.21.0</version.maven-pmd-plugin> @@ -149,15 +149,15 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.eclipse.aether</groupId> - <artifactId>aether-api</artifactId> - <version>${aether.version}</version> + <groupId>org.apache.maven.resolver</groupId> + <artifactId>maven-resolver-api</artifactId> + <version>${resolver.version}</version> <scope>provided</scope> </dependency> <dependency> - <groupId>org.eclipse.aether</groupId> - <artifactId>aether-util</artifactId> - <version>${aether.version}</version> + <groupId>org.apache.maven.resolver</groupId> + <artifactId>maven-resolver-util</artifactId> + <version>${resolver.version}</version> </dependency> <dependency> <groupId>org.eclipse.sisu</groupId> @@ -202,13 +202,6 @@ </dependency> <!-- test dependencies --> - <dependency> - <groupId>org.junit</groupId> - <artifactId>junit-bom</artifactId> - <version>5.10.2</version> - <type>pom</type> - <scope>import</scope> - </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId>