Skip to content
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
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
<version>43</version>
<version>45</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -166,6 +166,7 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>${version.maven-plugin-tools}</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -276,6 +277,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.9.1</version>
<configuration>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<projectsDirectory>src/it/projects</projectsDirectory>
Expand Down
16 changes: 12 additions & 4 deletions src/it/projects/active-profiles_multimodule/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
4 changes: 2 additions & 2 deletions src/it/projects/describe-cmd/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 6 additions & 2 deletions src/it/projects/describe-cmd/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
30 changes: 22 additions & 8 deletions src/it/projects/effective-pom_properties/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)' +
' <properties>' + LS +
' <maven\\.compiler\\.source>1\\.6</maven\\.compiler\\.source>' + LS +
' <maven\\.compiler\\.target>1\\.6</maven\\.compiler\\.target>' + LS +
'.*' +
' </properties>') != 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)' +
' <properties>' + LS +
' <maven\\.compiler\\.target>8</maven\\.compiler\\.target>' + LS +
' <maven\\.compiler\\.source>8</maven\\.compiler\\.source>' + LS +
'.*' +
' </properties>') != null

} else {
assert buildLog.text.find(
'(?s)' +
' <properties>' + LS +
' <maven\\.compiler\\.source>1\\.6</maven\\.compiler\\.source>' + LS +
' <maven\\.compiler\\.target>1\\.6</maven\\.compiler\\.target>' + LS +
'.*' +
' </properties>') != null
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<version>@version.maven-enforcer-plugin@</version>
<executions>
<execution>
<id>enforce-currentproject</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -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+
37 changes: 37 additions & 0 deletions src/it/projects/evaluate-forceStdout-raw-streems/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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>
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.help</groupId>
<artifactId>test</artifactId>
<version>1.0</version>

<description>
The description.
</description>

<build>
<plugins>
</plugins>
</build>
</project>
19 changes: 19 additions & 0 deletions src/it/projects/evaluate-forceStdout-raw-streems/test.properties
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions src/it/projects/evaluate-forceStdout-raw-streems/verify.groovy
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 2 additions & 0 deletions src/it/projects/evaluate-forceStdout/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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-
7 changes: 6 additions & 1 deletion src/it/projects/evaluate-forceStdout/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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()
12 changes: 12 additions & 0 deletions src/it/projects/evaluate-settings-servers/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private String readFile(String path) throws IOException {
private static final class InterceptingLog extends DefaultLog {
final List<String> warnLogs = new ArrayList<>();

public InterceptingLog(Logger logger) {
InterceptingLog(Logger logger) {
super(logger);
}

Expand Down
12 changes: 10 additions & 2 deletions src/test/java/org/apache/maven/plugins/help/DescribeMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private static final class InterceptingLog extends DefaultLog {

final List<String> warnLogs = new ArrayList<>();

public InterceptingLog(Logger logger) {
InterceptingLog(Logger logger) {
super(logger);
this.isInfoEnabled = true;
}
Expand Down