英文:
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 ofmaven-metadata-central.xml
. But the file timestamp onmaven-metadata-central.xml
is almost a month later (2022-10-02) than that ofmaven-metadata-central.xml.sha1
(2022-09-08). - The
<lastUpdated>20210818055556</lastUpdated>
insidemaven-metadata-central.xml
, as mentioned above, indicates 2610-06-16. - The
resolver-status.properties
file timestamp is identical to that ofmaven-metadata-central.xml.sha1
, so they were apparently modified at the same time. The comments insideresolver-status.properties
also say it was modified on 2022-09-08, and thecentral.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 <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 ofmaven-metadata-central.xml
. But the file timestamp onmaven-metadata-central.xml
is almost a month later (2022-10-02) than that ofmaven-metadata-central.xml.sha1
(2022-09-08). - The
<lastUpdated>20210818055556</lastUpdated>
insidemaven-metadata-central.xml
, as mentioned above, indicates 2610-06-16. - The
resolver-status.properties
file timestamp is identical to that ofmaven-metadata-central.xml.sha1
, so they were apparently modified at the same time. The comments insideresolver-status.properties
also say it was modified on 2022-09-08, and thecentral.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?
答案1
得分: 1
你的问题基于一个错误的假设,即在 maven-metadata.xml
中,<lastUpdated>
的值是Linux纪元时间戳。
实际上,<lastUpdated>
的值是以**yyyyMMddHHmmss
**时间戳形式给出的。
例如,你可以在 Versions Maven Plugin 的maven-metadata.xml
文件 中看到如下内容:<code><lastUpdated>20230221231058</lastUpdated></code>,因为它的最新版本 2.15.0 是在2023年2月发布的。
英文:
Your question is based on the false assumption that in maven-metadata.xml
the <lastUpdated>
values are Linux epoch timestamps.
In fact, the <lastUpdated>
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><lastUpdated>20230221231058</lastUpdated></code> as its latest version 2.15.0 has been released in February 2023.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论