“Maven lastUpdated timestamps in maven-metadata.xml have been set to the future.”

huangapple go评论57阅读模式
英文:

Maven lastUpdated timestamps in maven-metadata.xml have been set to the future

问题

I am using Maven 3.9.1 on Windows 10. I also use Eclipse EE 2023-03, which contains m2e (Eclipse's support for Maven). I am checking a POM for plugin version updates using the Versions Maven Plugin, but many aren't showing up even though another person sees updates available in Maven Central when checking against the same POM. (See Issue #959.) After some investigation it appears that the <lastUpdated> values in maven-metadata.xml in my local repository have been set to the future. I can try to override them, but first I am trying to find out how it happened so that I can prevent it from happening again.

I ran the following update to get Maven debug information:

mvn -X versions:display-plugin-updates

Here is part of my result:

…
[DEBUG] Checking com.akathist.maven.plugins.launch4j:launch4j-maven-plugin for updates newer than 2.1.3
[DEBUG] Could not find metadata com.akathist.maven.plugins.launch4j:launch4j-maven-plugin/maven-metadata.xml in local (C:\Users\user\.m2\repository)
[DEBUG] Skipped remote request for com.akathist.maven.plugins.launch4j:launch4j-maven-plugin/maven-metadata.xml, locally cached metadata up-to-date
[DEBUG] [com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].version=2.1.3
[DEBUG] [com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].artifactVersion=2.1.2
[DEBUG] [com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].effectiveVersion=2.1.3
[DEBUG] [com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].specified=true
…

However another person ran this output, and it indicated the following update (among others which also don't show up for me):

com.akathist.maven.plugins.launch4j:launch4j-maven-plugin 2.1.3 -> 2.4.1

It looks like on my machine Maven isn't seeing that com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:2.1.3 needed updating. This debug information seems to be saying that it can't find C:\Users\user\.m2\repository\com\akathist\maven\plugins\launch4j\launch4j-maven-plugin\maven-metadata.xml. And in fact that file does not exist! Instead I have C:\Users\user\.m2\repository\com\akathist\maven\plugins\launch4j\launch4j-maven-plugin\maven-metadata-central.xml. (It's not clear to me what the difference is, and I can't find information about this online.)

But the more ominous line is this one:

[DEBUG] Skipped remote request for com.akathist.maven.plugins.launch4j:launch4j-maven-plugin/maven-metadata.xml, locally cached metadata up-to-date

The maven-metadata-central.xml file contains <lastUpdated>20210818055556</lastUpdated>, and an online Linux epoch timestamp converter tells me that this date is Saturday, June 16, 2610 12:07:35.556 PM!

Here is more information on files inside C:\Users\user\.m2\repository\com\akathist\maven\plugins\launch4j\launch4j-maven-plugin\:

  • The checksum in maven-metadata-central.xml.sha1 matches the SHA-1 hash of maven-metadata-central.xml. But the file timestamp on maven-metadata-central.xml is almost a month later (2022-10-02) than that of maven-metadata-central.xml.sha1 (2022-09-08).
  • The <lastUpdated>20210818055556</lastUpdated> inside maven-metadata-central.xml, as mentioned above, indicates 2610-06-16.
  • The resolver-status.properties file timestamp is identical to that of maven-metadata-central.xml.sha1, so they were apparently modified at the same time. The comments inside resolver-status.properties also say it was modified on 2022-09-08, and the central.maven-metadata-central.xml.lastUpdated=1662676475074 inside the file also seems to say that Maven Central was checked on that date.

Interestingly 2022-09-08 is when I released v0.8.10 of this POM to Maven Central. As part of doing that, I used versions:use-releases, versions:set, and versions:display-dependency-updates; along with the Nexus Staging Maven Plugin of course. Since the checksum of maven-metadata-central.xml matches that in maven-metadata-central.xml.sha1, which was updated on 2022-09-08, it seems likely that the incorrect <lastUpdated>20210818055556</lastUpdated> was set on 2022-09-08.

Has anyone heard of what plugin or version of Maven or Eclipse m2e version or any bug or circumstances that might have resulted in setting <lastUpdated> to a date in the future for metadata in the C:\Users\user\.m2\repository\ tree?

英文:

I am using Maven 3.9.1 on Windows 10. I also use Eclipse EE 2023-03, which contains m2e (Eclipse's support for Maven). I am checking a POM for plugin version updates using the Versions Maven Plugin, but many aren't showing up even though another person sees updates available in Maven Central when checking against the same POM. (See Issue #959.) After some investigation it appears that the &lt;lastUpdated&gt; values in maven-metadata.xml in my local repository have been set to the future. I can try to override them, but first I am trying to find out how it happened so that I can prevent it from happening again.

I ran the following update to get Maven debug information:

mvn -X versions:display-plugin-updates

Here is part of my result:

…
[DEBUG] Checking com.akathist.maven.plugins.launch4j:launch4j-maven-plugin for updates newer than 2.1.3
[DEBUG] Could not find metadata com.akathist.maven.plugins.launch4j:launch4j-maven-plugin/maven-metadata.xml in local (C:\Users\user\.m2\repository)
[DEBUG] Skipped remote request for com.akathist.maven.plugins.launch4j:launch4j-maven-plugin/maven-metadata.xml, locally cached metadata up-to-date
[DEBUG] [com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].version=2.1.3
[DEBUG] [com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].artifactVersion=2.1.2
[DEBUG] [com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].effectiveVersion=2.1.3
[DEBUG] [com.akathist.maven.plugins.launch4j:launch4j-maven-plugin].specified=true
…

However another person ran this output, and it indicated the following update (among others which also don't show up for me):

> com.akathist.maven.plugins.launch4j:launch4j-maven-plugin 2.1.3 -&gt; 2.4.1

It looks like on my machine Maven isn't seeing that com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:2.1.3 needed updating. This debug information seems to be saying that it can't find C:\Users\user\.m2\repository\com\akathist\maven\plugins\launch4j\launch4j-maven-plugin\maven-metadata.xml. And in fact that file does not exist! Instead I have C:\Users\user\.m2\repository\com\akathist\maven\plugins\launch4j\launch4j-maven-plugin\maven-metadata-central.xml. (It's not clear to me what the difference is, and I can't find information about this online.)

But the more ominous line is this one:

> [DEBUG] Skipped remote request for com.akathist.maven.plugins.launch4j:launch4j-maven-plugin/maven-metadata.xml, locally cached metadata up-to-date

The maven-metadata-central.xml file contains &lt;lastUpdated&gt;20210818055556&lt;/lastUpdated&gt;, and an online Linux epoch timestamp converter tells me that this date is Saturday, June 16, 2610 12:07:35.556 PM!

Here is more information on files inside C:\Users\user\.m2\repository\com\akathist\maven\plugins\launch4j\launch4j-maven-plugin\:

  • The checksum in maven-metadata-central.xml.sha1 matches the SHA-1 hash of maven-metadata-central.xml. But the file timestamp on maven-metadata-central.xml is almost a month later (2022-10-02) than that of maven-metadata-central.xml.sha1 (2022-09-08).
  • The &lt;lastUpdated&gt;20210818055556&lt;/lastUpdated&gt; inside maven-metadata-central.xml, as mentioned above, indicates 2610-06-16.
  • The resolver-status.properties file timestamp is identical to that of maven-metadata-central.xml.sha1, so they were apparently modified at the same time. The comments inside resolver-status.properties also say it was modified on 2022-09-08, and the central.maven-metadata-central.xml.lastUpdated=1662676475074 inside the file also seems to say that Maven Central was checked on that date.

Interestingly 2022-09-08 is when I released v0.8.10 of this POM to Maven Central. As part of doing that, I used versions:use-releases, versions:set, and versions:display-dependency-updates; along with the Nexus Staging Maven Plugin of course. Since the checksum of maven-metadata-central.xml matches that in maven-metadata-central.xml.sha1, which was updated on 2022-09-08, it seems likely that the incorrect &lt;lastUpdated&gt;20210818055556&lt;/lastUpdated&gt; was set on 2022-09-08.

Has anyone heard of what plugin or version of Maven or Eclipse m2e version or any bug or circumstances that might have resulted in setting &lt;lastUpdated&gt; to a date in the future for metadata in the C:\Users\user\.m2\repository\ tree?

答案1

得分: 1

你的问题基于一个错误的假设,即在 maven-metadata.xml 中,&lt;lastUpdated&gt; 的值是Linux纪元时间戳

实际上,&lt;lastUpdated&gt; 的值是以**yyyyMMddHHmmss**时间戳形式给出的。

例如,你可以在 Versions Maven Pluginmaven-metadata.xml文件 中看到如下内容:<code>&lt;lastUpdated>20230221231058&lt;/lastUpdated></code>,因为它的最新版本 2.15.0 是在2023年2月发布的。

英文:

Your question is based on the false assumption that in maven-metadata.xml the &lt;lastUpdated&gt; values are Linux epoch timestamps.

In fact, the &lt;lastUpdated&gt; values are given as yyyyMMddHHmmss timestamps.

For example, you can see this in the maven-metadata.xml file of the Versions Maven Plugin currently contains <code>&lt;lastUpdated>20230221231058&lt;/lastUpdated></code> as its latest version 2.15.0 has been released in February 2023.

huangapple
  • 本文由 发表于 2023年5月21日 22:33:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76300423.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定