diff --git a/pom.xml b/pom.xml index ea265747..b5dd97c3 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache.maven.plugins maven-plugins - 43 + 45 @@ -166,6 +166,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations + ${version.maven-plugin-tools} provided @@ -276,6 +277,7 @@ org.apache.maven.plugins maven-invoker-plugin + 3.9.1 ${project.build.directory}/local-repo src/it/projects diff --git a/src/it/projects/active-profiles_multimodule/verify.groovy b/src/it/projects/active-profiles_multimodule/verify.groovy index c2072675..c49b7ade 100644 --- a/src/it/projects/active-profiles_multimodule/verify.groovy +++ b/src/it/projects/active-profiles_multimodule/verify.groovy @@ -20,7 +20,15 @@ def buildLog = new File( basedir, 'build.log' ); assert buildLog.exists() -assert 2 == buildLog.text.count( ' - mph79 (source: org.apache.maven.its.help:active-profiles_multimodule:1.0-SNAPSHOT)' ) -assert 1 == buildLog.text.count( ' - mph79-child (source: org.apache.maven.its.help:active-profiles_multimodule-module:1.0-SNAPSHOT)' ) -assert 0 == buildLog.text.count( ' - mph79-child-inactive' ) -assert 2 == buildLog.text.count( ' - it-repo (source: external)' ) +if (mavenVersion.startsWith( '4.' )) { + assert 1 == buildLog.text.count(' - mph79 (source: org.apache.maven.its.help:active-profiles_multimodule:pom:1.0-SNAPSHOT)') + assert 1 == buildLog.text.count(' - mph79 (source: org.apache.maven.its.help:active-profiles_multimodule-module:jar:1.0-SNAPSHOT)') + assert 1 == buildLog.text.count('- mph79-child (source: org.apache.maven.its.help:active-profiles_multimodule-module:jar:1.0-SNAPSHOT)') + +} else { + assert 2 == buildLog.text.count(' - mph79 (source: org.apache.maven.its.help:active-profiles_multimodule:1.0-SNAPSHOT)') + assert 1 == buildLog.text.count(' - mph79-child (source: org.apache.maven.its.help:active-profiles_multimodule-module:1.0-SNAPSHOT)') +} + +assert 0 == buildLog.text.count(' - mph79-child-inactive') +assert 2 == buildLog.text.count(' - it-repo (source: external)') diff --git a/src/it/projects/describe-cmd/invoker.properties b/src/it/projects/describe-cmd/invoker.properties index ecf6e305..2769786a 100644 --- a/src/it/projects/describe-cmd/invoker.properties +++ b/src/it/projects/describe-cmd/invoker.properties @@ -18,5 +18,5 @@ invoker.goals.1 = ${project.groupId}:${project.artifactId}:${project.version}:describe invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:describe -invoker.systemPropertiesFile.1 = test-deploy.properties -invoker.systemPropertiesFile.2 = test-site.properties +invoker.userPropertiesFile.1 = test-deploy.properties +invoker.userPropertiesFile.2 = test-site.properties diff --git a/src/it/projects/describe-cmd/verify.groovy b/src/it/projects/describe-cmd/verify.groovy index 5a044f1e..6cecaeae 100644 --- a/src/it/projects/describe-cmd/verify.groovy +++ b/src/it/projects/describe-cmd/verify.groovy @@ -21,8 +21,12 @@ def result = new File(basedir, 'result-deploy.txt').text; def ls = System.getProperty( "line.separator" ); -assert result.contains("'deploy' is a phase corresponding to this plugin:" + ls + - "org.apache.maven.plugins:maven-deploy-plugin") +if (mavenVersion.startsWith('4.')) { + assert result.contains("'deploy' is a phase within the 'default' lifecycle, which has the following phases:") +} else { + assert result.contains("'deploy' is a phase corresponding to this plugin:" + ls + + "org.apache.maven.plugins:maven-deploy-plugin") +} result = new File(basedir, 'result-site.txt').text; diff --git a/src/it/projects/effective-pom_properties/verify.groovy b/src/it/projects/effective-pom_properties/verify.groovy index 09f91a85..dd2be3d3 100644 --- a/src/it/projects/effective-pom_properties/verify.groovy +++ b/src/it/projects/effective-pom_properties/verify.groovy @@ -19,11 +19,25 @@ def buildLog = new File(basedir, 'build.log'); assert buildLog.exists() -def LS = System.getProperty("line.separator") -assert buildLog.text.find( -'(?s)' + -' ' + LS + -' 1\\.6' + LS + -' 1\\.6' + LS + -'.*' + -' ') != null +def LS = System.getProperty("line.separator") +if (mavenVersion.startsWith('4.')) { + // we have defined properties maven.compiler.source/target to 8 as user properties for execution + // Maven 4 take precedence over the pom properties + // also order of properties is changed in Maven 4 + assert buildLog.text.find( + '(?s)' + + ' ' + LS + + ' 8' + LS + + ' 8' + LS + + '.*' + + ' ') != null + +} else { + assert buildLog.text.find( + '(?s)' + + ' ' + LS + + ' 1\\.6' + LS + + ' 1\\.6' + LS + + '.*' + + ' ') != null +} diff --git a/src/it/projects/evaluate-artifact-with-expression-with-output/pom.xml b/src/it/projects/evaluate-artifact-with-expression-with-output/pom.xml index 7176ee40..9ee377e0 100644 --- a/src/it/projects/evaluate-artifact-with-expression-with-output/pom.xml +++ b/src/it/projects/evaluate-artifact-with-expression-with-output/pom.xml @@ -47,7 +47,7 @@ under the License. org.apache.maven.plugins maven-enforcer-plugin - 1.4.1 + @version.maven-enforcer-plugin@ enforce-currentproject diff --git a/src/it/projects/evaluate-forceStdout-raw-streems/invoker.properties b/src/it/projects/evaluate-forceStdout-raw-streems/invoker.properties new file mode 100644 index 00000000..1bc38ebc --- /dev/null +++ b/src/it/projects/evaluate-forceStdout-raw-streems/invoker.properties @@ -0,0 +1,21 @@ +# 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.goals = ${project.groupId}:${project.artifactId}:${project.version}:evaluate -q --raw-streams +invoker.debug = false +# --raw-streams available since Maven 3.9.11 +invoker.maven.version = 3.9.11+ diff --git a/src/it/projects/evaluate-forceStdout-raw-streems/pom.xml b/src/it/projects/evaluate-forceStdout-raw-streems/pom.xml new file mode 100644 index 00000000..aabc9fd8 --- /dev/null +++ b/src/it/projects/evaluate-forceStdout-raw-streems/pom.xml @@ -0,0 +1,37 @@ + + + + + + 4.0.0 + + org.apache.maven.its.help + test + 1.0 + + + The description. + + + + + + + diff --git a/src/it/projects/evaluate-forceStdout-raw-streems/test.properties b/src/it/projects/evaluate-forceStdout-raw-streems/test.properties new file mode 100644 index 00000000..a14aca61 --- /dev/null +++ b/src/it/projects/evaluate-forceStdout-raw-streems/test.properties @@ -0,0 +1,19 @@ +# 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. + +expression = project.version +forceStdout = true diff --git a/src/it/projects/evaluate-forceStdout-raw-streems/verify.groovy b/src/it/projects/evaluate-forceStdout-raw-streems/verify.groovy new file mode 100644 index 00000000..cf792232 --- /dev/null +++ b/src/it/projects/evaluate-forceStdout-raw-streems/verify.groovy @@ -0,0 +1,25 @@ +/* + * 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. + */ + +// for JDK25 and later, ignore lines starting with "WARNING: " +// https://github.com/apache/maven/issues/10312 + +assert '1.0' == new File(basedir, 'build.log').readLines().findAll { + !it.startsWith('Picked up JAVA_TOOL_OPTIONS: ') && !it.startsWith('WARNING: ') && it != '' +}.first() diff --git a/src/it/projects/evaluate-forceStdout/invoker.properties b/src/it/projects/evaluate-forceStdout/invoker.properties index 13d149d5..de210ae7 100644 --- a/src/it/projects/evaluate-forceStdout/invoker.properties +++ b/src/it/projects/evaluate-forceStdout/invoker.properties @@ -17,3 +17,5 @@ invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:evaluate -q invoker.debug = false +# for Maven 4 we need --raw-streams +invoker.maven.version = 4- diff --git a/src/it/projects/evaluate-forceStdout/verify.groovy b/src/it/projects/evaluate-forceStdout/verify.groovy index 09ff343f..cf792232 100644 --- a/src/it/projects/evaluate-forceStdout/verify.groovy +++ b/src/it/projects/evaluate-forceStdout/verify.groovy @@ -17,4 +17,9 @@ * under the License. */ -assert '1.0' == new File(basedir, 'build.log').readLines().findAll{ !it.startsWith('Picked up JAVA_TOOL_OPTIONS: ') }.first() +// for JDK25 and later, ignore lines starting with "WARNING: " +// https://github.com/apache/maven/issues/10312 + +assert '1.0' == new File(basedir, 'build.log').readLines().findAll { + !it.startsWith('Picked up JAVA_TOOL_OPTIONS: ') && !it.startsWith('WARNING: ') && it != '' +}.first() diff --git a/src/it/projects/evaluate-settings-servers/invoker.properties b/src/it/projects/evaluate-settings-servers/invoker.properties index e9c555f7..a50d2e96 100644 --- a/src/it/projects/evaluate-settings-servers/invoker.properties +++ b/src/it/projects/evaluate-settings-servers/invoker.properties @@ -16,3 +16,15 @@ # under the License. invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:evaluate + +invoker.maven.version = 4- + +# Error on Maven 4 +# Caused by: com.thoughtworks.xstream.converters.ConversionException: No converter available +# ---- Debugging information ---- +# message : No converter available +# type : java.util.ImmutableCollections$MapN +# converter : com.thoughtworks.xstream.converters.reflection.SerializableConverter +# message[1] : Unable to make private void java.util.ImmutableCollections$MapN.readObject(java.io.ObjectInputStream) throws java.io.IOException,java.lang.ClassNotFoundException accessible: module java.base does not "opens java.util" to unnamed module @50bf795f +# converter[1] : com.thoughtworks.xstream.converters.reflection.ReflectionConverter +# message[2] : Unable to make field transient java.util.Set java.util.AbstractMap.keySet accessible: module java.base does not "opens java.util" to unnamed module @50bf795f diff --git a/src/test/java/org/apache/maven/plugins/help/AllProfilesMojoTest.java b/src/test/java/org/apache/maven/plugins/help/AllProfilesMojoTest.java index 2df3ebac..01c1aa81 100644 --- a/src/test/java/org/apache/maven/plugins/help/AllProfilesMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/help/AllProfilesMojoTest.java @@ -189,7 +189,7 @@ private String readFile(String path) throws IOException { private static final class InterceptingLog extends DefaultLog { final List warnLogs = new ArrayList<>(); - public InterceptingLog(Logger logger) { + InterceptingLog(Logger logger) { super(logger); } diff --git a/src/test/java/org/apache/maven/plugins/help/DescribeMojoTest.java b/src/test/java/org/apache/maven/plugins/help/DescribeMojoTest.java index fe22060e..1701328f 100644 --- a/src/test/java/org/apache/maven/plugins/help/DescribeMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/help/DescribeMojoTest.java @@ -39,8 +39,16 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; /** * @author Vincent Siveton diff --git a/src/test/java/org/apache/maven/plugins/help/EvaluateMojoTest.java b/src/test/java/org/apache/maven/plugins/help/EvaluateMojoTest.java index f65fee03..2dbeea39 100644 --- a/src/test/java/org/apache/maven/plugins/help/EvaluateMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/help/EvaluateMojoTest.java @@ -161,7 +161,7 @@ private static final class InterceptingLog extends DefaultLog { final List warnLogs = new ArrayList<>(); - public InterceptingLog(Logger logger) { + InterceptingLog(Logger logger) { super(logger); this.isInfoEnabled = true; }