[MNG-6391] - Added IT to check output.
- Added MavenITmng6391PrintVersionTest
- Kept MavenITmng6352PrintVersionTest
diff --git a/.gitignore b/.gitignore
index 5fb5e3a..aa380b5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@
.idea
jvz-*
.flattened-pom.xml
+.checkstyle
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index 9dcef0b..9515e73 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -704,7 +704,7 @@
suite.addTestSuite( MavenIT0008SimplePluginTest.class );
suite.addTestSuite( MavenITmng6210CoreExtensionsCustomScopesTest.class );
suite.addTestSuite( MavenITmng6352PrintVersionTest.class );
-
+ suite.addTestSuite( MavenITmng6391PrintVersionTest.class );
/*
* Add tests in reverse alpha order above.
*/
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6352PrintVersionTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6352PrintVersionTest.java
index aeafcc2..72e8d41 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6352PrintVersionTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6352PrintVersionTest.java
@@ -42,7 +42,7 @@
public MavenITmng6352PrintVersionTest()
{
- super( "[3.5.3-SNAPSHOT,)" );
+ super( "[3.5.3-SNAPSHOT,3.5.4-SNAPSHOT]" );
}
/**
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java
new file mode 100644
index 0000000..a5bd6cd
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6391PrintVersionTest.java
@@ -0,0 +1,159 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * An integration test to check the enhancements to print out version
+ * information during the reactor summary output at the correct
+ * positions.
+ *
+ * <a href="https://issues.apache.org/jira/browse/MNG-6391">MNG-6391</a>.
+ *
+ * @author Karl Heinz Marbaise khmarbaise@apache.org
+ */
+public class MavenITmng6391PrintVersionTest
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng6391PrintVersionTest()
+ {
+ super( "[3.6.0-SNAPSHOT,)" );
+ }
+
+ /**
+ * Check that the resulting output is
+ * as expected for the root module and last
+ * module in build but not for the intermediate
+ * modules.
+ */
+ public void testitShouldPrintVersionAtTopAndAtBottom()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6391-print-version" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+ verifier.setMavenDebug( false );
+ verifier.setAutoclean( false );
+
+ verifier.setLogFileName( "version-log.txt" );
+ verifier.executeGoals( Arrays.asList( "clean" ) );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ List<String> loadedLines = verifier.loadLines( "version-log.txt", "UTF-8" );
+ List<String> resultingLines = extractReactorBuildOrder( loadedLines );
+
+ // We expecting exactly four lines as result.
+ assertEquals( 5, resultingLines.size() );
+
+ // We expect those lines in the following exact order.
+ assertTrue( resultingLines.get( 0 ).startsWith( "[INFO] Reactor Summary for base-project 1.3.0-SNAPSHOT:" ) );
+ assertTrue( resultingLines.get( 1 ).startsWith( "[INFO] base-project ....................................... SUCCESS [" ) );
+ assertTrue( resultingLines.get( 2 ).startsWith( "[INFO] module-1 ........................................... SUCCESS [" ) );
+ assertTrue( resultingLines.get( 3 ).startsWith( "[INFO] module-2 ........................................... SUCCESS [" ) );
+ assertTrue( resultingLines.get( 4 ).startsWith( "[INFO] module-3 ........................................... SUCCESS [" ) );
+
+ }
+
+ /**
+ * Check that the resulting output is
+ * as expected for all modules in case
+ * for an aggregator build.
+ */
+ public void testitShouldPrintVersionInAllLines()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6391-print-version-aggregator" );
+
+ Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
+ verifier.setMavenDebug( false );
+ verifier.setAutoclean( false );
+
+ verifier.setLogFileName( "version-log.txt" );
+ verifier.executeGoals( Arrays.asList( "clean" ) );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ List<String> loadedLines = verifier.loadLines( "version-log.txt", "UTF-8" );
+ List<String> resultingLines = extractReactorBuildOrder( loadedLines );
+
+ // We expecting exactly four lines as result.
+ assertEquals( 5, resultingLines.size() );
+
+ // We expect those lines in the following exact order.
+ assertTrue( resultingLines.get( 0 ).startsWith( "[INFO] Reactor Summary:" ) );
+ assertTrue( resultingLines.get( 1 ).startsWith( "[INFO] module-1 1.2.7.43.RELEASE .......................... SUCCESS [ " ) );
+ assertTrue( resultingLines.get( 2 ).startsWith( "[INFO] module-2 7.5-SNAPSHOT .............................. SUCCESS [ " ) );
+ assertTrue( resultingLines.get( 3 ).startsWith( "[INFO] module-3 1-RC1 ..................................... SUCCESS [ " ) );
+ assertTrue( resultingLines.get( 4 ).startsWith( "[INFO] base-project 1.0.0-SNAPSHOT ........................ SUCCESS [ " ) );
+
+ }
+
+ /**
+ * Extract the lines at the end of the Maven output:
+ *
+ * <pre>
+ * [INFO] Reactor Summary..: XXX
+ * [INFO]
+ * [INFO] ...SUCCESS [ 0.035 s]
+ * [INFO] ...SUCCESS [ 0.035 s]
+ * [INFO] ...SUCCESS [ 0.035 s]
+ * </pre>
+ */
+ private List<String> extractReactorBuildOrder( List<String> loadedLines )
+ {
+ List<String> resultingLines = new LinkedList<String>();
+ boolean start = false;
+ for ( String line : loadedLines )
+ {
+ if ( start )
+ {
+ if ( line.startsWith( "[INFO] -------------" ) )
+ {
+ start = false;
+ }
+ else if ( !line.endsWith( "[INFO] " ) )
+ {
+ resultingLines.add( line );
+ }
+ }
+ else
+ {
+ if ( line.startsWith( "[INFO] Reactor Summary" ) )
+ {
+ start = true;
+ resultingLines.add( line );
+ }
+
+ }
+ }
+ return resultingLines;
+
+ }
+
+}
diff --git a/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/module-1/pom.xml b/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/module-1/pom.xml
new file mode 100644
index 0000000..f5cad17
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/module-1/pom.xml
@@ -0,0 +1,30 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>module-1</artifactId>
+ <version>1.2.7.43.RELEASE</version>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/module-2/pom.xml b/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/module-2/pom.xml
new file mode 100644
index 0000000..abc040e
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/module-2/pom.xml
@@ -0,0 +1,30 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>module-2</artifactId>
+ <version>7.5-SNAPSHOT</version>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/module-3/pom.xml b/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/module-3/pom.xml
new file mode 100644
index 0000000..b52cbec
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/module-3/pom.xml
@@ -0,0 +1,30 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>module-3</artifactId>
+ <version>1-RC1</version>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/pom.xml b/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/pom.xml
new file mode 100644
index 0000000..e643563
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6391-print-version-aggregator/pom.xml
@@ -0,0 +1,58 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>base-project</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>module-1</module>
+ <module>module-2</module>
+ <module>module-3</module>
+ </modules>
+
+ <build>
+ <pluginManagement><!-- see bootstrap for plugins versions -->
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.5.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6391-print-version/module-1/pom.xml b/core-it-suite/src/test/resources/mng-6391-print-version/module-1/pom.xml
new file mode 100644
index 0000000..822f847
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6391-print-version/module-1/pom.xml
@@ -0,0 +1,33 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>base-project</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>module-1</artifactId>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6391-print-version/module-2/pom.xml b/core-it-suite/src/test/resources/mng-6391-print-version/module-2/pom.xml
new file mode 100644
index 0000000..1a04229
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6391-print-version/module-2/pom.xml
@@ -0,0 +1,41 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>base-project</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>module-2</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>module-1</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6391-print-version/module-3/pom.xml b/core-it-suite/src/test/resources/mng-6391-print-version/module-3/pom.xml
new file mode 100644
index 0000000..dfad8a2
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6391-print-version/module-3/pom.xml
@@ -0,0 +1,41 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>base-project</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>module-3</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>module-2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6391-print-version/pom.xml b/core-it-suite/src/test/resources/mng-6391-print-version/pom.xml
new file mode 100644
index 0000000..db545d8
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6391-print-version/pom.xml
@@ -0,0 +1,58 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>mng-6352-print-version</groupId>
+ <artifactId>base-project</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>module-3</module>
+ <module>module-1</module>
+ <module>module-2</module>
+ </modules>
+
+ <build>
+ <pluginManagement><!-- see bootstrap for plugins versions -->
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.5.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>