0

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>
Ceddaerrix
  • 304
  • 1
  • 14
  • 1
    where did you add `${user.home}\my-repository\path\to\the\artifact\version\dependency-version.jar` ? Could you add more info: 1. your `pom.xml` 2. do you use some custom `settings.xml` for maven? – Rustam Dec 20 '22 at 16:00
  • @Rustam - Here are a few complementary information: 1) ${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. 2) the setting.xml is set at project-level into the .mvn directory along with a maven,config file. 3) I am not entitled to provide any of the pom.xml files (NDA stuff) – Ceddaerrix Dec 21 '22 at 09:20
  • got it, it is not necessary to provide all `pom.xml`, just which plugin is used inside your ``, do you use some repositories in ? Looks like there are lack of information in your setting.xml, and also looks like you have repositories tag in pom.xml with `https://host:port..`, however it should be some placeholder for `host` and `port`. You have to config setting.xml correctly: https://maven.apache.org/settings.html – Rustam Dec 21 '22 at 09:34
  • @Rustam - As mentioned in my latest edits, the repositories tag are in the `.mvn/settings.xml` (instead of the pom.xml) with `https://host:port/repository/my-repo/`. Searching here and there I am just wondering if I should add from SSL-related properties into the MAVEN_OPTS – Ceddaerrix Dec 23 '22 at 04:50
  • `https://host:port` is not correct, use necessary `host` and `port` – Rustam Dec 23 '22 at 08:58

0 Answers0