Compiler error “archive for required library could

2020-01-27 12:49发布

I am starting to configure my development environment and I am using Spring Tool Suite 2.8.1 along with m2E 1.01.

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.

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?

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.

Markers

19条回答
霸刀☆藐视天下
2楼-- · 2020-01-27 13:20

Alternatively, below commands also worked for me:

mvn -s settings.xml eclipse:clean
mvn -s settings.xml eclipse:eclipse
查看更多
你好瞎i
3楼-- · 2020-01-27 13:21

I face with the same issue. I deleted the local repository and relaunched the ID. It worked fine .

查看更多
Juvenile、少年°
4楼-- · 2020-01-27 13:22

I faced this problem. I had "Archive for required library spring-boot-devtools cannot be read or is not a valid ZIP file" and the solution was like that:- 1- determine the dependencies names that have problems(for may case it is spring-boot-devtools). 2- close eclipse. 3- search in your .m2 file on these dependencies(by name). 4- delete these folders. 5- reopen eclipse and let maven rebuild your dependencies again.

查看更多
Animai°情兽
5楼-- · 2020-01-27 13:27

In my case I had to manually delete all the files in .m2\repository folder and then open command prompt and run mvn -install command in my project directory.

查看更多
Evening l夕情丶
6楼-- · 2020-01-27 13:27

I deleted the local maven repository. Then just rightclick the project -> Maven -> Update Project... Select all concerned projects and click OK.

查看更多
祖国的老花朵
7楼-- · 2020-01-27 13:31

Below Steps resolved my issue.

  1. Go to ./m2/repository folder.

  2. Go to respective archive error folder.

  3. Verify any zip file is exist.

  4. delete error name folder.

  5. Now come to Eclipse Project - Right Click - Maven - > Update Project.

Above trick works for me.

查看更多
登录 后发表回答