Colle
Colle

Reputation: 154

Maven eclipse error: "Archive for required library cannot be read or is not a valid ZIP file"

I got the "Archive for required library cannot be read or is not a valid ZIP file" error for my maven project I imported in Eclipse. I read some posts about this and suggested is to delete the faulty directory like in my case:
~.m2\repository\com\cogentex\rpw\2.2 and
~.m2\repository\com\cogentex\rpw-lkb\2.2
Then you should update the project via Eclipse: Maven>Update project and click force update of snapshots/releases. I followed these steps and the directory looks like this now:
screenshot

So the correct .jar files are still missing and it also results in more erorrs now:
1: Missing artifact com.cogentex:rpw-lkb:jar:2.2
2: Missing artifact com.cogentex:rpw:jar:2.2
3: The container 'Maven Dependencies' references non existing library '~.m2\repository\com\cogentex\rpw\2.2\rpw-2.2.jar'

Here is the snippet from the pom.xml which throws the first two errors:

    <dependency>
        <groupId>com.cogentex</groupId>
        <artifactId>rpw</artifactId>
        <version>2.2</version>
    </dependency>

    <dependency>
        <groupId>com.cogentex</groupId>
        <artifactId>rpw-lkb</artifactId>
        <version>2.2</version>
    </dependency>

What do I have to do to make maven download the correct .jar files? I already tried running maven cleanor maven install and restarting Eclipse.

Upvotes: 1

Views: 956

Answers (1)

Milen Dyankov
Milen Dyankov

Reputation: 3052

What you see in the folder is some files that indicate the artifact was not found and when was the last time Maven checked.

Whatever com.cogentex:rpw is, it's not in Maven Central so Maven will not find it there. You need to tell Maven where to get it from by providing the URL to a repository that contains it. If/when your POM has the repository, make sure

  • you do have access to the reposiory from the environment you run your build in (check proxies, firewalls, ...)
  • the GAV coordinates (groupId, artifactId, version) are correct and match the one in the repository.
  • the artifact type in the repository is jar. If it is not, provide the correct type in the dependency
  • the artifact is not deployed to the repository with classifier. If it is, provide the classifier in the dependency

Upvotes: 1

Related Questions