You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2020/11/11 18:01:57 UTC

[maven-integration-testing] branch mng-6754-version-timestamp-in-multimodule-build updated (dcd7b43 -> 905c3c7)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch mng-6754-version-timestamp-in-multimodule-build
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git.


 discard dcd7b43  [MNG-6754] Set the same timestamp in multi module builds
     new e6389fb  [MNG-6754] Set the same timestamp in multi module builds (1/2)
     new 905c3c7  Stage two

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (dcd7b43)
            \
             N -- N -- N   refs/heads/mng-6754-version-timestamp-in-multimodule-build (905c3c7)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 core-it-suite/pom.xml                              |  39 ++---
 ...avenITmng6754TimestampInMultimoduleProject.java | 168 +++++++++++++++------
 2 files changed, 142 insertions(+), 65 deletions(-)


[maven-integration-testing] 01/02: [MNG-6754] Set the same timestamp in multi module builds (1/2)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch mng-6754-version-timestamp-in-multimodule-build
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit e6389fb8f54e5dd8f8c45b4678188a95e0a4dd03
Author: Maarten Mulders <mt...@apache.org>
AuthorDate: Mon Nov 9 21:05:50 2020 +0100

    [MNG-6754] Set the same timestamp in multi module builds (1/2)
    
    Install and deploy a multi module project, compare local and remote
    last updated timestamps with each other and Maven build timestamp.
    
    This closes #76
---
 .../org/apache/maven/it/IntegrationTestSuite.java  |   1 +
 ...avenITmng6754TimestampInMultimoduleProject.java | 124 +++++++++++++++++++++
 .../child-a/pom.xml                                |  40 +++++++
 .../org/apache/maven/its/mng6754/DelayingTest.java |  33 ++++++
 .../child-b/pom.xml                                |  40 +++++++
 .../org/apache/maven/its/mng6754/DelayingTest.java |  33 ++++++
 .../pom.xml                                        |  93 ++++++++++++++++
 7 files changed, 364 insertions(+)

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 24fd5b7..8238b15 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
@@ -107,6 +107,7 @@ public class IntegrationTestSuite
         // -------------------------------------------------------------------------------------------------------------
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
 
+        suite.addTestSuite( MavenITmng6754TimestampInMultimoduleProject.class );
         suite.addTestSuite( MavenITmng6981ProjectListShouldIncludeChildrenTest.class );
         suite.addTestSuite( MavenITmng6972AllowAccessToGraphPackageTest.class );
         suite.addTestSuite( MavenITmng6772NestedImportScopeRepositoryOverride.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java
new file mode 100644
index 0000000..247050a
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java
@@ -0,0 +1,124 @@
+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.util.ResourceExtractor;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static java.util.Arrays.asList;
+
+public class MavenITmng6754TimestampInMultimoduleProject
+        extends AbstractMavenIntegrationTestCase
+{
+    private static final Pattern LAST_UPDATED_LINE = Pattern.compile( "<lastUpdated>(\\d*)</lastUpdated>" );
+    private static final String RESOURCE_PATH = "/mng-6754-version-timestamp-in-multimodule-build";
+
+
+    public MavenITmng6754TimestampInMultimoduleProject()
+    {
+        super( "[3.7.0,)" );
+    }
+
+    public void testArtifactsHaveSameTimestamp()
+            throws Exception
+    {
+        final File testDir = ResourceExtractor.simpleExtractResources( getClass(), RESOURCE_PATH );
+        final Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        final Path localRepoDir = Paths.get( verifier.getLocalRepository() );
+        final Path remoteRepoDir = Paths.get( verifier.getBasedir(), "repo" );
+
+        verifier.deleteDirectory( "repo" );
+        verifier.deleteArtifacts ( "org.apache.maven.its.mng6754" );
+        verifier.addCliOption( "-Drepodir=" + remoteRepoDir );
+        verifier.executeGoals( asList( "install", "deploy" ) );
+        verifier.verifyErrorFreeLog();
+
+        final Properties props = verifier.loadProperties( "target/timestamp.properties" );
+        final String mavenBuildTimestamp = props.getProperty( "project.properties.timestamp" );
+
+        final String parentLastUpdatedLocal = getLastUpdatedFromMetadata( getLocalMetadataPath( localRepoDir, "parent" ) );
+        final String aLastUpdatedLocal = getLastUpdatedFromMetadata( getLocalMetadataPath( localRepoDir, "child-a" ) );
+        final String bLastUpdatedLocal = getLastUpdatedFromMetadata( getLocalMetadataPath( localRepoDir, "child-b" ) );
+
+        final String parentLastUpdatedRemote = getLastUpdatedFromMetadata( getRemoteMetadataPath( remoteRepoDir, "parent" ) );
+        final String aLastUpdatedRemote = getLastUpdatedFromMetadata( getRemoteMetadataPath( remoteRepoDir, "child-a" ) );
+        final String bLastUpdatedRemote = getLastUpdatedFromMetadata( getRemoteMetadataPath( remoteRepoDir, "child-b" ) );
+
+        assertEquals( "Installed child modules should have equal lastUpdated in maven-metadata-local.xml",
+                aLastUpdatedLocal, bLastUpdatedLocal );
+        assertEquals( "Installed parent module should have equal lastUpdated in maven-metadata-local.xml as their children",
+                aLastUpdatedLocal, parentLastUpdatedLocal );
+        assertEquals( "Deployed child modules should have equal lastUpdated in maven-metadata.xml",
+                aLastUpdatedRemote, bLastUpdatedRemote );
+        assertEquals( "Deployed parent module should have equal lastUpdated in maven-metadata.xml as their children",
+                aLastUpdatedRemote, parentLastUpdatedRemote );
+        assertEquals( "Installed parent module should have equal lastUpdated as deployed counterparts",
+                parentLastUpdatedLocal, parentLastUpdatedRemote );
+        assertEquals( "Installed child-a module should have equal lastUpdated as deployed counterparts",
+                aLastUpdatedLocal, aLastUpdatedRemote );
+        assertEquals( "Installed child-b module should have equal lastUpdated as deployed counterparts",
+                bLastUpdatedLocal, bLastUpdatedRemote );
+        assertEquals( "Installed parent module should have equal lastUpdated as the Maven build timestamp",
+                parentLastUpdatedLocal, mavenBuildTimestamp );
+        assertEquals( "Deployed parent module should have equal lastUpdated as the Maven build timestamp",
+                parentLastUpdatedRemote, mavenBuildTimestamp );
+    }
+
+    private Path getLocalMetadataPath( final Path repoDir, final String moduleName )
+    {
+        final Path mng6754Path = Paths.get( "org", "apache", "maven", "its", "mng6754" );
+        final Path modulePath = repoDir.resolve( mng6754Path.resolve( moduleName ) );
+        return modulePath.resolve( "maven-metadata-local.xml" );
+    }
+
+    private Path getRemoteMetadataPath( final Path repoDir, final String moduleName )
+    {
+        final Path mng6754Path = Paths.get( "org", "apache", "maven", "its", "mng6754" );
+        final Path modulePath = repoDir.resolve( mng6754Path.resolve( moduleName ) );
+        return modulePath.resolve( "maven-metadata.xml" );
+    }
+
+    private String getLastUpdatedFromMetadata( final Path metadataFile ) throws IOException
+    {
+        final List<String> lines = Files.readAllLines( metadataFile, Charset.defaultCharset() );
+        for (final String line : lines )
+        {
+            final Matcher matcher = LAST_UPDATED_LINE.matcher( line );
+            if ( matcher.find() )
+            {
+                return matcher.group(1);
+            }
+        }
+
+        // just in case, make sure the test will fail if there's no <lastUpdated>
+        // inside "maven-metadata.xml"
+        return "";
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-a/pom.xml b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-a/pom.xml
new file mode 100644
index 0000000..d701aba
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-a/pom.xml
@@ -0,0 +1,40 @@
+<?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>org.apache.maven.its.mng6754</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>child-a</artifactId>
+    <name>Maven Integration Test :: Child A</name>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-a/src/test/java/org/apache/maven/its/mng6754/DelayingTest.java b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-a/src/test/java/org/apache/maven/its/mng6754/DelayingTest.java
new file mode 100644
index 0000000..63536a0
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-a/src/test/java/org/apache/maven/its/mng6754/DelayingTest.java
@@ -0,0 +1,33 @@
+package org.apache.maven.its.mng6754;
+
+/*
+ * 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.junit.Test;
+
+import java.util.concurrent.TimeUnit;
+
+public class DelayingTest
+{
+    @Test
+    public void generateSomeDelay() throws InterruptedException
+    {
+        TimeUnit.SECONDS.sleep( 1 );
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-b/pom.xml b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-b/pom.xml
new file mode 100644
index 0000000..bfc659f
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-b/pom.xml
@@ -0,0 +1,40 @@
+<?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>org.apache.maven.its.mng6754</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>child-b</artifactId>
+    <name>Maven Integration Test :: Child B</name>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-b/src/test/java/org/apache/maven/its/mng6754/DelayingTest.java b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-b/src/test/java/org/apache/maven/its/mng6754/DelayingTest.java
new file mode 100644
index 0000000..63536a0
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/child-b/src/test/java/org/apache/maven/its/mng6754/DelayingTest.java
@@ -0,0 +1,33 @@
+package org.apache.maven.its.mng6754;
+
+/*
+ * 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.junit.Test;
+
+import java.util.concurrent.TimeUnit;
+
+public class DelayingTest
+{
+    @Test
+    public void generateSomeDelay() throws InterruptedException
+    {
+        TimeUnit.SECONDS.sleep( 1 );
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/pom.xml b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/pom.xml
new file mode 100644
index 0000000..fcbb78d
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-6754-version-timestamp-in-multimodule-build/pom.xml
@@ -0,0 +1,93 @@
+<?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>org.apache.maven.its.mng6754</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <packaging>pom</packaging>
+
+    <name>Maven Integration Test :: MNG-6754</name>
+    <description>
+        Test that version timestamp is equal for each module in the build.
+    </description>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+        <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
+        <timestamp>${maven.build.timestamp}</timestamp>
+    </properties>
+
+    <distributionManagement>
+        <repository>
+            <id>maven-core-it</id>
+            <url>file:///${repodir}</url>
+        </repository>
+    </distributionManagement>
+
+    <modules>
+        <module>child-a</module>
+        <module>child-b</module>
+    </modules>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>4.12</version>
+                <scope>test</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-expression</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <outputFile>target/timestamp.properties</outputFile>
+          <expressions>
+            <expression>project/properties/timestamp</expression>
+          </expressions>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>eval</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>


[maven-integration-testing] 02/02: Stage two

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch mng-6754-version-timestamp-in-multimodule-build
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit 905c3c7f587bb6e5427d53719d239e1c56e993fb
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Wed Nov 11 19:01:39 2020 +0100

    Stage two
---
 core-it-suite/pom.xml                              |  39 ++---
 ...avenITmng6754TimestampInMultimoduleProject.java | 168 +++++++++++++++------
 2 files changed, 142 insertions(+), 65 deletions(-)

diff --git a/core-it-suite/pom.xml b/core-it-suite/pom.xml
index 926e116..f1931f4 100644
--- a/core-it-suite/pom.xml
+++ b/core-it-suite/pom.xml
@@ -36,34 +36,34 @@ under the License.
 
   <!--
   By default, the project just packages the tests in an artifact. To actually run them, activate the profile "run-its":
-  
+
     mvn clean test -Prun-its
-  
+
   This will subject the Maven version running the build to the integration tests. If you would like to test a different
   Maven distribution, you can use the system property "mavenHome" to specify the path of the Maven distribution to test:
-  
+
     mvn clean test -Prun-its -DmavenHome=<maven-under-test>
-  
+
   Alternatively, you can just specify the version of a previously installed/deployed Maven distribution which will be
   downloaded, unpacked and tested:
 
     mvn clean test -Prun-its -DmavenVersion=2.2.1
-  
+
   It's also possible to point the ITs at an already downloaded Maven distribution:
-  
+
     mvn clean test -Prun-its -DmavenDistro=<path-to-bin-archive>
-  
+
   To run the ITs using embedded Maven 3.x, additionally activate the profile "embedded".
-  
+
   ITs that don't require to fork Maven can also be run from the IDE using the Maven projects from the workspace if the
   Maven dependencies are added to the test class path.
 
   To test with the maven wrapper, you should add the wrapperDistroDir too.
 
     mvn clean test -Prun-its -Dmaven.repo.local=<path-to-local-repo>  -DmavenDistro=<path-to-bin-archive> -DwrapperDistroDir=<path-to-wrapper-distro-directory> -DmavenWrapper=<path-to-wrapper-jar>
-	
+
   Tests can pick up the maven.wrapper.distrodir system property to unpack it into their testDir to verify the wrapper.
-  
+
   If you're behind a proxy, use the system properties proxy.host, proxy.port, proxy.user, proxy.pass and
   proxy.nonProxyHosts to specify the required proxy setup for the ITs. Alternatively, set the system property
   maven.it.central to a URL of a local repository manager (anonymous authentication only) that proxies the
@@ -74,7 +74,7 @@ under the License.
     <surefireMemory>-Xmx384m</surefireMemory>
     <!-- The original Maven distribution to test. -->
     <mavenHome>${maven.home}</mavenHome>
-    <!-- The (possibly instrumented copy of the) Maven distribution we actually 
+    <!-- The (possibly instrumented copy of the) Maven distribution we actually
       use for the tests. -->
     <preparedMavenHome>${mavenHome}</preparedMavenHome>
     <!-- default properties used to filter the global settings -->
@@ -113,13 +113,13 @@ under the License.
       <groupId>org.apache.maven.its</groupId>
       <artifactId>maven-it-helper</artifactId>
       <version>2.1-SNAPSHOT</version>
-      <!-- TODO: not transitive in tests artifact, so must be left in main 
+      <!-- TODO: not transitive in tests artifact, so must be left in main
         scope <scope>test</scope> -->
     </dependency>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-verifier</artifactId>
-      <!-- TODO: not transitive in tests artifact, so must be left in main 
+      <!-- TODO: not transitive in tests artifact, so must be left in main
         scope <scope>test</scope> -->
     </dependency>
     <dependency>
@@ -158,6 +158,11 @@ under the License.
       <version>0.3.4</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-repository-metadata</artifactId>
+      <version>3.6.3</version>
+    </dependency>
   </dependencies>
 
   <build>
@@ -283,7 +288,7 @@ under the License.
             <configuration>
               <systemProperties combine.children="append">
                 <property>
-                  <!-- Pass this through to the tests (if set!) to have them 
+                  <!-- Pass this through to the tests (if set!) to have them
                     pick the right repository -->
                   <name>maven.repo.local</name>
                   <value>${maven.repo.local}</value>
@@ -308,7 +313,7 @@ under the License.
             <configuration>
               <systemProperties combine.children="append">
                 <property>
-                  <!-- Pass this through to the tests (if set!) to have them 
+                  <!-- Pass this through to the tests (if set!) to have them
                     pick the right repository layout -->
                   <name>maven.repo.local.layout</name>
                   <value>${maven.repo.local.layout}</value>
@@ -327,7 +332,7 @@ under the License.
       <properties>
          <surefireMemory>-Xmx384m -XX:MaxPermSize=192m</surefireMemory>
       </properties>
-    </profile> 
+    </profile>
     <profile>
       <id>embedded</id>
       <build>
@@ -339,7 +344,7 @@ under the License.
               <forkMode>once</forkMode>
               <argLine>${surefireMemory}
                 -Dcom.sun.management.jmxremote=true</argLine>
-              <!-- NOTE: Maven plugins have access to the system class path 
+              <!-- NOTE: Maven plugins have access to the system class path
                 so keep it clean -->
               <useSystemClassLoader>false</useSystemClassLoader>
               <systemProperties combine.children="append">
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java
index 247050a..3ac66f0 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6754TimestampInMultimoduleProject.java
@@ -19,26 +19,29 @@ package org.apache.maven.it;
  * under the License.
  */
 
-import org.apache.maven.it.util.ResourceExtractor;
+import static java.util.Arrays.asList;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.charset.Charset;
+import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.List;
 import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
-import static java.util.Arrays.asList;
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
+
+
+
+import org.apache.maven.it.util.ResourceExtractor;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 public class MavenITmng6754TimestampInMultimoduleProject
         extends AbstractMavenIntegrationTestCase
 {
-    private static final Pattern LAST_UPDATED_LINE = Pattern.compile( "<lastUpdated>(\\d*)</lastUpdated>" );
     private static final String RESOURCE_PATH = "/mng-6754-version-timestamp-in-multimodule-build";
+    private static final String VERSION = "1.0-SNAPSHOT";
 
 
     public MavenITmng6754TimestampInMultimoduleProject()
@@ -61,64 +64,133 @@ public class MavenITmng6754TimestampInMultimoduleProject
         verifier.verifyErrorFreeLog();
 
         final Properties props = verifier.loadProperties( "target/timestamp.properties" );
+        // Reference timestamp
         final String mavenBuildTimestamp = props.getProperty( "project.properties.timestamp" );
 
-        final String parentLastUpdatedLocal = getLastUpdatedFromMetadata( getLocalMetadataPath( localRepoDir, "parent" ) );
-        final String aLastUpdatedLocal = getLastUpdatedFromMetadata( getLocalMetadataPath( localRepoDir, "child-a" ) );
-        final String bLastUpdatedLocal = getLastUpdatedFromMetadata( getLocalMetadataPath( localRepoDir, "child-b" ) );
-
-        final String parentLastUpdatedRemote = getLastUpdatedFromMetadata( getRemoteMetadataPath( remoteRepoDir, "parent" ) );
-        final String aLastUpdatedRemote = getLastUpdatedFromMetadata( getRemoteMetadataPath( remoteRepoDir, "child-a" ) );
-        final String bLastUpdatedRemote = getLastUpdatedFromMetadata( getRemoteMetadataPath( remoteRepoDir, "child-b" ) );
-
-        assertEquals( "Installed child modules should have equal lastUpdated in maven-metadata-local.xml",
-                aLastUpdatedLocal, bLastUpdatedLocal );
-        assertEquals( "Installed parent module should have equal lastUpdated in maven-metadata-local.xml as their children",
-                aLastUpdatedLocal, parentLastUpdatedLocal );
-        assertEquals( "Deployed child modules should have equal lastUpdated in maven-metadata.xml",
-                aLastUpdatedRemote, bLastUpdatedRemote );
-        assertEquals( "Deployed parent module should have equal lastUpdated in maven-metadata.xml as their children",
-                aLastUpdatedRemote, parentLastUpdatedRemote );
-        assertEquals( "Installed parent module should have equal lastUpdated as deployed counterparts",
-                parentLastUpdatedLocal, parentLastUpdatedRemote );
-        assertEquals( "Installed child-a module should have equal lastUpdated as deployed counterparts",
-                aLastUpdatedLocal, aLastUpdatedRemote );
-        assertEquals( "Installed child-b module should have equal lastUpdated as deployed counterparts",
-                bLastUpdatedLocal, bLastUpdatedRemote );
-        assertEquals( "Installed parent module should have equal lastUpdated as the Maven build timestamp",
-                parentLastUpdatedLocal, mavenBuildTimestamp );
-        assertEquals( "Deployed parent module should have equal lastUpdated as the Maven build timestamp",
-                parentLastUpdatedRemote, mavenBuildTimestamp );
+        final Metadata parentMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "parent", null ) );
+        final Metadata aMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "child-a", null ) );
+        final Metadata bMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "child-b", null ) );
+
+        final String parentLastUpdatedLocal = parentMetadataLocal.getVersioning().getLastUpdated();
+        final String aLastUpdatedLocal = aMetadataLocal.getVersioning().getLastUpdated();
+        final String bLastUpdatedLocal = bMetadataLocal.getVersioning().getLastUpdated();
+
+        assertEquals ( "parent", "local", "lastUpdated", mavenBuildTimestamp, parentLastUpdatedLocal );
+        assertEquals ( "child-a", "local", "lastUpdated", mavenBuildTimestamp, aLastUpdatedLocal );
+        assertEquals ( "child-b", "local", "lastUpdated", mavenBuildTimestamp, bLastUpdatedLocal );
+
+        final Metadata parentVersionedMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "parent", VERSION ) );
+        final Metadata aVersionedMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "child-a", VERSION ) );
+        final Metadata bVersionedMetadataLocal = getMetadata( getLocalMetadataPath( localRepoDir, "child-b", VERSION ) );
+
+        final String parentVersionedLastUpdatedLocal = parentVersionedMetadataLocal.getVersioning().getLastUpdated();
+        final String parentVersionedSnapshotVersionUpdatedLocal = parentVersionedMetadataLocal.getVersioning().getSnapshotVersions().get(0).getUpdated();
+        final String aLastVersionedUpdatedLocal = aVersionedMetadataLocal.getVersioning().getLastUpdated();
+        final String aVersionedSnapshotVersionUpdated1Local = aVersionedMetadataLocal.getVersioning().getSnapshotVersions().get(0).getUpdated();
+        final String aVersionedSnapshotVersionUpdated2Local = aVersionedMetadataLocal.getVersioning().getSnapshotVersions().get(1).getUpdated();
+        final String bLastVersionedUpdatedLocal = bVersionedMetadataLocal.getVersioning().getLastUpdated();
+        final String bVersionedSnapshotVersionUpdated1Local = bVersionedMetadataLocal.getVersioning().getSnapshotVersions().get(0).getUpdated();
+        final String bVersionedSnapshotVersionUpdated2Local = bVersionedMetadataLocal.getVersioning().getSnapshotVersions().get(1).getUpdated();
+
+        assertEquals ( "parent", "local", "lastUpdated", mavenBuildTimestamp, parentVersionedLastUpdatedLocal );
+        assertEquals ( "parent", "local", "snapshotVersion[0]/updated", mavenBuildTimestamp, parentVersionedSnapshotVersionUpdatedLocal );
+        assertEquals ( "child-a", "local", "lastUpdated", mavenBuildTimestamp, aLastVersionedUpdatedLocal );
+        assertEquals ( "child-a", "local", "snapshotVersion[0]/updated", mavenBuildTimestamp, aVersionedSnapshotVersionUpdated1Local );
+        assertEquals ( "child-a", "local", "snapshotVersion[1]/updated", mavenBuildTimestamp, aVersionedSnapshotVersionUpdated2Local );
+        assertEquals ( "child-b", "local", "lastUpdated", mavenBuildTimestamp, bLastVersionedUpdatedLocal );
+        assertEquals ( "child-b", "local", "snapshotVersion[0]/updated", mavenBuildTimestamp, bVersionedSnapshotVersionUpdated1Local );
+        assertEquals ( "child-b", "local", "snapshotVersion[1]/updated", mavenBuildTimestamp, bVersionedSnapshotVersionUpdated2Local );
+
+        final Metadata parentMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "parent", null ) );
+        final Metadata aMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "child-a", null ) );
+        final Metadata bMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "child-b", null ) );
+
+        final String parentLastUpdatedRemote = parentMetadataRemote.getVersioning().getLastUpdated();
+        final String aLastUpdatedRemote = aMetadataRemote.getVersioning().getLastUpdated();
+        final String bLastUpdatedRemote = bMetadataRemote.getVersioning().getLastUpdated();
+
+        assertEquals ( "parent", "remote", "lastUpdated", mavenBuildTimestamp, parentLastUpdatedRemote );
+        assertEquals ( "child-a", "remote", "lastUpdated", mavenBuildTimestamp, aLastUpdatedRemote );
+        assertEquals ( "child-b", "remote", "lastUpdated", mavenBuildTimestamp, bLastUpdatedRemote );
+
+        final Metadata parentVersionedMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "parent", VERSION ) );
+        final Metadata aVersionedMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "child-a", VERSION ) );
+        final Metadata bVersionedMetadataRemote = getMetadata( getRemoteMetadataPath( remoteRepoDir, "child-b", VERSION ) );
+
+        final String parentVersionedLastUpdatedRemote = parentVersionedMetadataRemote.getVersioning().getLastUpdated();
+        final String parentVersionedSnapshotTimestamp = parentVersionedMetadataRemote.getVersioning().getSnapshot().getTimestamp().replace(".", "");
+        final String parentVersionedSnapshotVersionUpdatedRemote = parentVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(0).getUpdated();
+        final String parentVersionedSnapshotVersionValueRemote = parentVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(0).getVersion();
+        final String aLastVersionedUpdatedRemote = aVersionedMetadataRemote.getVersioning().getLastUpdated();
+        final String aVersionedSnapshotTimestamp = aVersionedMetadataRemote.getVersioning().getSnapshot().getTimestamp().replace(".", "");
+        final String aVersionedSnapshotVersionUpdated1Remote = aVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(0).getUpdated();
+        final String aVersionedSnapshotVersionValue1Remote = aVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(0).getVersion();
+        final String aVersionedSnapshotVersionUpdated2Remote = aVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(1).getUpdated();
+        final String aVersionedSnapshotVersionValue2Remote = aVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(1).getVersion();
+        final String bLastVersionedUpdatedRemote = bVersionedMetadataRemote.getVersioning().getLastUpdated();
+        final String bVersionedSnapshotTimestamp = bVersionedMetadataRemote.getVersioning().getSnapshot().getTimestamp().replace(".", "");
+        final String bVersionedSnapshotVersionUpdated1Remote = bVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(0).getUpdated();
+        final String bVersionedSnapshotVersionValue1Remote = bVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(0).getVersion();
+        final String bVersionedSnapshotVersionUpdated2Remote = bVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(1).getUpdated();
+        final String bVersionedSnapshotVersionValue2Remote = bVersionedMetadataRemote.getVersioning().getSnapshotVersions().get(1).getVersion();
+
+        assertEquals ( "parent", "remote", "lastUpdated", mavenBuildTimestamp, parentVersionedLastUpdatedRemote );
+        assertEquals ( "parent", "remote", "snapshot/timestamp", mavenBuildTimestamp, parentVersionedSnapshotTimestamp );
+        assertEquals ( "parent", "remote", "snapshotVersion[0]/updated", mavenBuildTimestamp, parentVersionedSnapshotVersionUpdatedRemote );
+        assertEquals ( "child-a", "remote", "lastUpdated", mavenBuildTimestamp, aLastVersionedUpdatedRemote );
+        assertEquals ( "child-a", "remote", "snapshot/timestamp", mavenBuildTimestamp, aVersionedSnapshotTimestamp );
+        assertEquals ( "child-a", "remote", "snapshotVersion[0]/updated", mavenBuildTimestamp, aVersionedSnapshotVersionUpdated1Remote );
+        assertEquals ( "child-a", "remote", "snapshotVersion[1]/updated", mavenBuildTimestamp, aVersionedSnapshotVersionUpdated2Remote );
+        assertEquals ( "child-b", "remote", "lastUpdated", mavenBuildTimestamp, bLastVersionedUpdatedRemote );
+        assertEquals ( "child-b", "remote", "snapshot/timestamp", mavenBuildTimestamp, bVersionedSnapshotTimestamp );
+        assertEquals ( "child-b", "remote", "snapshotVersion[0]/updated", mavenBuildTimestamp, bVersionedSnapshotVersionUpdated1Remote );
+        assertEquals ( "child-b", "remote", "snapshotVersion[1]/updated", mavenBuildTimestamp, bVersionedSnapshotVersionUpdated2Remote );
     }
 
-    private Path getLocalMetadataPath( final Path repoDir, final String moduleName )
+    private Path getLocalMetadataPath( final Path repoDir, final String moduleName, String version )
     {
         final Path mng6754Path = Paths.get( "org", "apache", "maven", "its", "mng6754" );
-        final Path modulePath = repoDir.resolve( mng6754Path.resolve( moduleName ) );
+        Path modulePath = repoDir.resolve( mng6754Path.resolve( moduleName ) );
+        if ( version != null )
+        {
+            modulePath = modulePath.resolve( version );
+        }
         return modulePath.resolve( "maven-metadata-local.xml" );
     }
 
-    private Path getRemoteMetadataPath( final Path repoDir, final String moduleName )
+    private Path getRemoteMetadataPath( final Path repoDir, final String moduleName, String version )
     {
         final Path mng6754Path = Paths.get( "org", "apache", "maven", "its", "mng6754" );
-        final Path modulePath = repoDir.resolve( mng6754Path.resolve( moduleName ) );
+        Path modulePath = repoDir.resolve( mng6754Path.resolve( moduleName ) );
+        if ( version != null )
+        {
+            modulePath = modulePath.resolve( version );
+        }
         return modulePath.resolve( "maven-metadata.xml" );
     }
 
-    private String getLastUpdatedFromMetadata( final Path metadataFile ) throws IOException
+    private Metadata getMetadata( final Path metadataFile ) throws IOException, XmlPullParserException
     {
-        final List<String> lines = Files.readAllLines( metadataFile, Charset.defaultCharset() );
-        for (final String line : lines )
+        MetadataXpp3Reader r = new MetadataXpp3Reader();
+        try ( InputStream is = Files.newInputStream( metadataFile ) )
         {
-            final Matcher matcher = LAST_UPDATED_LINE.matcher( line );
-            if ( matcher.find() )
-            {
-                return matcher.group(1);
-            }
+            return r.read( is );
         }
+    }
 
-        // just in case, make sure the test will fail if there's no <lastUpdated>
-        // inside "maven-metadata.xml"
-        return "";
+    private void assertEquals( String module, String location, String field, String expected, String actual )
+    {
+        String phase = null;
+        switch ( location )
+        {
+        case "local":
+            phase = "Installed";
+            break;
+        case "remote":
+            phase = "Deployed";
+            break;
+        }
+        assertEquals( String.format( "%s %s module should have equal %s %s with the Maven build timestamp",
+                 phase, module, location, field ), expected, actual );
     }
 }