eclipse Maven 下载的扩展名为 .lastUpdated

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2529218/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:17:51  来源:igfitidea点击:

Maven downloads have .lastUpdated as extension

eclipsemaven-2

提问by user303158

I have an Eclipse setup with m2eclipse and subversive. I have imported a maven2 project from svn. But I get the error message that a whole bunch of artifacts are missing (for instance: Missing artifact org.springframework:spring-test:jar:3.0.1.RELEASE:test).

我有一个带有 m2eclipse 和 subversive 的 Eclipse 设置。我从 svn 导入了一个 maven2 项目。但是我收到错误消息,说缺少一大堆工件(例如:缺少工件 org.springframework:spring-test:jar:3.0.1.RELEASE:test)。

If I look in my repository I see the jar files there but they have an extra extension .lastUpdated. Why is maven appending .lastUpdated to the jars? And more importantly: how can I fix this?

如果我查看我的存储库,我会在那里看到 jar 文件,但它们有一个额外的扩展名 .lastUpdated。为什么 maven 将 .lastUpdated 附加到罐子里?更重要的是:我该如何解决这个问题?

There is no mention of the type lastUpdated in my POMs.

我的 POM 中没有提到 lastUpdated 类型。

回答by J?rn Guy Sü?

These files indicate to Maven that it attempted to obtain the archive by download, but was unsuccessful. In order to save bandwidth it will not attempt this again until a certain time period encoded in the file has elapsed. The command line switch -U force maven to perform the update before the retry period. This may be necessary if you attempted to build while disconnected from the network.

这些文件向 Maven 表明它试图通过下载获取档案,但没有成功。为了节省带宽,在文件中编码的特定时间段过去之前,它不会再次尝试此操作。命令行开关 -U 强制 maven 在重试期之前执行更新。如果您在与网络断开连接的情况下尝试构建,这可能是必要的。

The method of removing the files works with most versions of maven, but since the files are internal mementos to maven, I would not recommend this method. There is no guarantee that this information is not referenced or held elsewhere and such manipulation can damage the system.

删除文件的方法适用于大多数版本的 maven,但由于文件是 maven 的内部纪念品,我不推荐这种方法。无法保证此信息不会被引用或保存在其他地方,并且此类操作可能会损坏系统。

回答by Rubens Mariuzzo

As rperezsaid, I use to delete all those .lastUpdatedfiles. In Linux I have created a little script to keep it simple:

正如rperez所说,我用来删除所有这些.lastUpdated文件。在 Linux 中,我创建了一个小脚本来保持简单

find -name \*.lastUpdated -exec rm -fv {} +

Just create a file with the previous content and put it on your local Maven repository. Usually it will be ~/.m2/repository.

只需使用以前的内容创建一个文件并将其放在您本地的 Maven 存储库中。通常它会~/.m2/repository

回答by user303158

I installed Maven2 and ran mvn compile from the command line. This seems to have resolved the problem

我安装了 Maven2 并从命令行运行了 mvn compile。这似乎解决了问题

回答by carlspring

If you hit this problem and you're using Nexus, it might be the case that you have a routing rule defined, which is incorrect. I hit this myself and the files it was downloading were correctly named, at the proper URL-s it was looking at, but they were all with the .lastUpdatedextension and an error message as contents.

如果您遇到此问题并且您正在使用 Nexus,则可能是您定义了路由规则,这是不正确的。我自己点击了这个,它正在下载的文件被正确命名,在它正在查看的正确 URL-s 上,但它们都带有.lastUpdated扩展名和错误消息作为内容。

回答by rperez

you might have a problem with some of the artifacts to be retrieved from the repository. for example spring framework has its own repository. this xtension is appended when the artifact cannot fully downloaded. add the spring framework repository to your pom or settings.xml, delete the folder that include the broken jars and start again

您可能对要从存储库中检索的某些工件有问题。例如 spring 框架有自己的存储库。当工件无法完全下载时,会附加此 xtension。将 spring 框架存储库添加到您的 pom 或 settings.xml,删除包含损坏的 jar 的文件夹并重新开始

回答by Edward Quixote

Open your terminal, navigate to your Eclipse's project directory and run:

打开终端,导航到 Eclipse 的项目目录并运行:

mvn install

If mvn installdoesn't update your dependencies, then call it with a switch to force update:

如果mvn install不更新您的依赖项,则使用开关调用它以强制更新:

mvn install -U

This is a much safer approach compared to tampering with maven files as you delete ".lastUpdated".

与在删除“.lastUpdated”时篡改 Maven 文件相比,这是一种更安全的方法。

回答by Adriano Ferreira de Paula

Use this command inside the .m2/repository dir to rename all files:

在 .m2/repository 目录中使用此命令重命名所有文件:

for file in `find . -iname *.lastUpdated`; do renamed=$(echo $file | rev | cut -c13- | rev); echo renaming: $file to $renamed; mv $file $renamed; done

This is usefull to not download all sources again.

这对于不再下载所有源很有用。

This not work... The .jar is lost. :(

这不起作用...... .jar 丢失了。:(