How do I make maven-metadata.xml the same timestamp as the wen artifact deployed with maven?

I have a Nexus 3 where I am deploying some artifacts from Jenkins using "mvn deploy". I have a lot of 500+ modules. The construction looks something like this:

mvn clean package -DskipTests -DskipITs -T C1

mvn install -DskipTests -DskipITs -T C1

mvn deploy --quiet -DskipTests -DskipITs -Dmaven.validate.skip=true -Dmaven.compile.skip=true -Dmaven.test.skip=true -Dmaven.package.skip=true -Dmaven.integration-test.skip=true -Dmaven.verify.skip=true -T C1

      

The problem is that from time to time my artifacts have a timestamp while the metadata has a different timestamp. Usually the difference is 1 second.

This is what I see in nexus at https://mynexus.com/repository/snapshots/com/company/my-artifact/1.0.0-SNAPSHOT/maven-metadata.xml

<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
  <groupId>com.company</groupId>
  <artifactId>my-artifact</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <timestamp>20170613.140447</timestamp>
      <buildNumber>1</buildNumber>
    </snapshot>
    <lastUpdated>20170613140447</lastUpdated>
    <snapshotVersions>
      <snapshotVersion>
        <extension>war</extension>
        <value>1.0.0-20170613.140447-1</value>
        <updated>20170613140447</updated>
      </snapshotVersion>
      <snapshotVersion>
        <extension>pom</extension>
        <value>1.0.0-20170613.140447-1</value>
        <updated>20170613140447</updated>
      </snapshotVersion>
    </snapshotVersions>
  </versioning>
</metadata>

      

Based on the maven-metadata.xml, the artifact url should be:

https://mynexus.com/repository/snapshots/com/company/my-artifact/1.0.0-SNAPSHOT/my-artifact/1.0.0-20170613.140447-1.war

But this is not the case. Instead, the artifact is at this location:

https://mynexus.com/repository/snapshots/com/company/my-artifact/1.0.0-SNAPSHOT/my-artifact/1.0.0-20170613.140446-1.war

mvn --version 64-bit OpenJDK server version Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21: 39: 06 + 02: 00) Maven home: / usr / local / apache-maven Java version: 1.8.0_131, vendor: Oracle Corporation Java home: / usr / lib / jvm / java-8-openjdk-amd64 / jre Default language: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.4.0-64 -generic ", arch:" amd64 ", family:" unix "

The maven-deploy-plugin version is 2.8.2

What am I doing wrong? How can I fix this? Thank!

+3


source to share


1 answer


This is a bug in Maven 3.5.0 and will be resolved in 3.5.1 release.

The original bug report set up the deploy-plugin ( https://issues.apache.org/jira/browse/MDEPLOY-221 ), however this is a maven core issue: https://issues.apache.org/jira/ browse / MNG-6240 .



We faced the same problem in my work and after some searching and searching on the mavens issue tracker I found the above links. I would suggest downgrading, pending 3.5.1 release.

+3


source







All Articles