diff --git a/enforcer-rules/pom.xml b/enforcer-rules/pom.xml index 744c4263..b0cd73a8 100644 --- a/enforcer-rules/pom.xml +++ b/enforcer-rules/pom.xml @@ -71,12 +71,12 @@ provided - org.eclipse.aether - aether-api + org.apache.maven.resolver + maven-resolver-api - org.eclipse.aether - aether-util + org.apache.maven.resolver + maven-resolver-util org.eclipse.sisu diff --git a/maven-enforcer-extension/src/it/projects/invoker.properties b/maven-enforcer-extension/src/it/projects/invoker.properties index 7283777b..9bbbd742 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 c4dc6a18..00000000 --- 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 1c82ab60..00000000 --- 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 adc16148..66b78c06 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 aa66e8ff..00000000 --- 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 1b780931..5705236e 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 ff7096b5..00000000 --- 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 4d907992..58b6526e 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 425ce068..00000000 --- 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 c4dc6a18..00000000 --- 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 e51755a7..831403e8 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 @@ 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.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.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 @@ * @author Brian Fox */ @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 106d7ed6..6799d8c5 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 @@ 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 @@ void setupMocks(Boolean hasComponent) { 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 9678a2b4..929a3f34 100644 --- a/pom.xml +++ b/pom.xml @@ -77,13 +77,13 @@ - 3.2.5 + 3.6.3 enforcer-archives/enforcer-LATEST 8 4.11.0 - 2024-05-26T08:52:43Z - - 1.0.0.v20140518 + 2023-09-07T17:27:52Z + + 1.4.1 3.21.0 @@ -149,15 +149,15 @@ provided - org.eclipse.aether - aether-api - ${aether.version} + org.apache.maven.resolver + maven-resolver-api + ${resolver.version} provided - org.eclipse.aether - aether-util - ${aether.version} + org.apache.maven.resolver + maven-resolver-util + ${resolver.version} org.eclipse.sisu @@ -202,13 +202,6 @@ - - org.junit - junit-bom - 5.10.2 - pom - import - org.mockito mockito-core