问题描述
我开始配置我的开发环境,我正在使用Spring Tool Suite 2.8.1以及m2E 1.01。
I am starting to configure my development environment and I am using Spring Tool Suite 2.8.1 along with m2E 1.01.
据我所知,因为这个是一个Maven项目(我的第一个),我的Maven POM正在指示(以及m2E smarts)我的项目构建配置和依赖项。
As far as I can tell, since this is a Maven Project (my first), my Maven POM is dictating (along with m2E smarts) my project build configuration and dependencies.
我想知道的是为什么当我在.m2存储库中看到jars时,我的IDE显示的是Java Build Problems,上面写着库 library / path / somejar.jar 所需的存档无法读取或不是有效的zip文件 ?
What I would like to know is why my IDE is displaying Java Build Problems that read "Archive required for library library/path/somejar.jar cannot be read or is not a valid zip file" when I can see the jars in my .m2 repository?
所有错误都与commons-logging:1.1.1有关,我在父pom中排除了。这是通过spring-context-support获得的转换依赖性:3.0.5。我从我的构建中排除了该库,现在错误与spring-context-support库有关。
All the errors pertained to commons-logging:1.1.1 which I excluded in my parent-pom. This was a transistive dependancy via spring-context-support:3.0.5. I excluded that library from my build and now the errors pertain to the spring-context-support library.
我附上了一个截图来说明。
I have attached a screenshot to illustrate.
推荐答案
确实IDE经常缓存本地存储库(Eclipse做类似的事情,我必须重新启动Eclipse)。
Indeed IDEs often cache the local repository (Eclipse does something similar, and I have to relaunch Eclipse).
一个丑陋的maven您可能遇到的行为是,如果您在实际安装之前声明了依赖关系,maven将创建缺少的依赖项的空版本(具有元数据但没有jar的文件夹),您将不得不手动清理.m2存储库。
One ugly maven behavior you might encounter is that if you declare a dependency before you actually install it, maven will create an empty version of the missing dependency (folder with metadata but no jar), and you will have to manually clean your .m2 repository.
第三,安装的存档(jar ...)可能会损坏,所以尝试用任何存档工具(7zip ...)打开它来测试它,然后删除如果存档已损坏整个文件夹。
Third, an installed archive (jar...) can get corrupted, so try to open it with any archive tool (7zip...) to test it, and delete the whole folder if the archive is corrupted.
这篇关于无法读取编译器错误“所需库的存档” - Spring Tool Suite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!