The timestamp in the maven-metadata.xml snapshot file is more than a second than the actual jar timestamp.

I ran into an unusual problem:

I used " mvn deploy " (Maven 3.3.9, Jenkins 2.45, Nexus 2.12.0) to deploy a jar of snapshots in my jenkins link as shown below (suppose the name is jar: userdao.jar ):

 Uploaded: myNexusIp/nexus/content/repositories/snapshots/xxx/1.0-SNAPSHOT/userdao-1.0-20170512.111840-6.jar Uploaded: myNexusIp/nexus/content/repositories/snapshots/xxx/1.0-SNAPSHOT/maven-metadata.xml 

The assembly was successful, and everything was in order.

But when I built another maven project that was above userdao.jar , an error occurred, as shown below:

 Could not find artifact userdao:jar:1.0-20170512.111840-6 in public (http://myNexusIp/nexus/content/groups/public/) 

After positioning, I found that the timestamp in maven-metadata.xml in the nexus was more than a second than the actual jar timestamp!
As below:

  • in maven-metadata.xml : 1.0-20170512.111840-6
  • actual existing snapshot: userdao-1.0-20170512.111839-6.jar

Since userdao-1.0-20170512.111840-6.jar did not exist on Nexus, the right one should be userdao-1.0-20170512.111839-6.jar , so there were errors.

Who can tell me why and how to solve it?

+11
maven maven-metadata nexus jenkins
source share
6 answers

I really found the opposite. After upgrading from Maven 3.3.9 to 3.5.0, I could reliably deploy artifacts where the time stamps appearing in the metadata.xml files on Nexus were incorrect compared to the actual files that were deployed.

With a decrease (to 3.3.9), everything worked correctly. The versions of metadata.xml and timestamps have always been updated.

Perhaps this has something to do with updating Maven 3.5.0 to remove ether?

+7
source share

This has been confirmed, the maven-3.5 problem https://issues.apache.org/jira/browse/MNG-6240 has been fixed. For the maven-3.5.1 release, the fix was voted here https://www.mail-archive.com/ dev@maven.apache.org /msg114783.html

+6
source share

The first thing to try is to rebuild your metadata into the repo where you uploaded the snapshot artifact.

See " Managing Scheduled Tasks "

Rebuild Maven Metadata Files

This task will rebuild the maven-metadata.xml files with the correct information and also check the checksums ( .md5 / .sha1 ) for all files in the specified repository / group.
Typically, this task is performed manually to repair a damaged repository.

+1
source share

I upgraded maven from 3.3.9 to 3.5.0, found that maven-metadata.xml was loaded once, and the problem was solved! So I think this is a bug in maven 3.3.9, my current solution is updating maven to 3.5.0.

+1
source share

I encountered the same problem when using Maven 3.3.9. Tested by upgrading to Maven 3.5.4, but the problem still exists. The problem of loading maven-metadata.xml was caused twice by the spotbug maven v3.1.3 plug-in. This was resolved in the latest maven version- 3.1.12 plugin on which I tested.

0
source share

I had the same problem with maven 3.3.9. In my case, upgrading to maven 3.5.4 solved the problem, no more than "twice as much" during the default deployment phase.

0
source share

All Articles