记一个mvn奇怪错误: Archive for required library: 'D:/mvn/repos/junit/junit/3.8.1/junit-3.8.1.jar' in project 'xxx' cannot be read or is not a valid ZIP file

时间:2022-05-19 07:57:37

我的maven 项目有一个红色感叹号, 而且Problems 存在 errors :

Description Resource Path Location Type
Archive for required library: 'D:/mvn/repos/junit/junit/3.8.1/junit-3.8.1.jar' in project 'xxx' cannot be read or is not a valid ZIP file ktb-mgr Maven Webapp Build path Build Path Problem

记一个mvn奇怪错误: Archive for required library: 'D:/mvn/repos/junit/junit/3.8.1/junit-3.8.1.jar' in project 'xxx' cannot be read or is not a valid ZIP file

junit-3.8.1.jar 是明明存在的啊! 而且本地mvn 也存在啊! 为什么还是这样的错误, Project -> Clean 后还是一样啊!

mvn clean compile 也是 BUILD SUCCESS, 为什么。。。?

等等, 好像有所不对。。。

记一个mvn奇怪错误: Archive for required library: 'D:/mvn/repos/junit/junit/3.8.1/junit-3.8.1.jar' in project 'xxx' cannot be read or is not a valid ZIP file

junit 里面竟然是空的! 。。。

我明白了, mvn clean compile 会 BUILD SUCCESS 是因为 我项目中没有用到 junit。。

重命名 junit jar , 再次mvn clean compile:

结果:

记一个mvn奇怪错误: Archive for required library: 'D:/mvn/repos/junit/junit/3.8.1/junit-3.8.1.jar' in project 'xxx' cannot be read or is not a valid ZIP file

eclipse中 再次 Project -> Clean , all right !