I have the following issue on a Maven project (with Maven 3.8.1):
Compilation failure
error: error reading ${user.home}\my-repository\path\to\the\artifact\version\dependency-version.jar; error in opening zip file
I have found a lot of posts on the matter (such as Maven : error in opening zip file when running maven) but none with a reliable solution. The only workaround that helps is to manual download the JAR file from a browser and save it at the location mentioned in the error.
In my case, I would like to know if the fact that the repository is over HTTPS and using an internal Certificate Authority could be the cause since:
- while investigating the issue, I saw warnings as follow:
[WARNING] Checksum validation failed, expected <!DOCTYPE but is 963eb274a2ab77544a448a617489e097a3797b81 from my-maven-repo for https://<host>:<port>/repository/my-maven-repo/path/to/the/artifact/version/dependency-version.pom
[WARNING] Could not validate integrity of download from https://<host>:<port>/repository/my-maven-repo/path/to/the/artifact/version/dependency-version.pom
org.eclipse.aether.transfer.ChecksumFailureException: Checksum validation failed, expected <!DOCTYPE but is 1bc04ac588e7b7f3a35851e63e9ff5f507579567
at org.eclipse.aether.connector.basic.ChecksumValidator.validateExternalChecksums (ChecksumValidator.java:174)
...
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
[WARNING] Checksum validation failed, expected <!DOCTYPE but is 1bc04ac588e7b7f3a35851e63e9ff5f507579567 from my-maven-repo for https://<host>:<port>/repository/my-maven-repo/path/to/the/artifact/version/dependency-version.pom
Downloaded from my-maven-repo: https://<host>:<port>/repository/my-maven-repo/path/to/the/artifact/version/dependency-version.pom (19 kB at 7.4 kB/s)
[WARNING] The POM for path.to.the:artifact:jar:version is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
- then, when opening https://host:port/repository/my-maven-repo/path/to/the/artifact/version/dependency-version.pom into a browser, it returns an error as : NET::ERR_CERT_AUTHORITY_INVALID
If so, how can I solved it?
NOTE:
- ${user.home} is the placeholder set in the setting.xml in the localRepository element, which refers to the .m2 directory under the current user directory.
- the setting.xml is set at project-level into the .mvn directory, along with a maven.config file, and holds all repositories configurations.
The pom.xml section:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*.conf</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<name>java.util.logging.config.file</name>
<value>${project.basedir}/src/main/resources/test/logging.properties</value>
</property>
<property>
<name>some_prop</name>
<value>some_value</value>
</property>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webappDirectory>${basedir}/target/tmp</webappDirectory>
<packagingIncludes>WEB-INF/lib/*.jar,
**/*.xml,**/*.idmap,**/*.info,
**/*.properties,**/*.class,**/*.png,**/*.css,**/*.js,**/*.jsp,**/MANIFEST.MF
</packagingIncludes>
<webxml>src/main/webapp/WEB-INF/web.xml</webxml>
<webResources>
<resource>
<directory>src/main/resources</directory>
<exclude>*.properties</exclude>
</resource>
</webResources>
</configuration>
<executions>
<execution>
<id>make-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>