Search code examples
javaeclipsemaven

Maven Failed to read artifact descriptor


While developing a Rest Client project on Apple silicon Mac Book Pro with Eclipse, got this Maven error while updating the project:

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.4 Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.4

My pom.xml looks like this:

  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>RestClient</groupId>
  <artifactId>RestClient</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
  <dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-client</artifactId>
    <version>2.29.1</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.inject</groupId>
    <artifactId>jersey-hk2</artifactId>
    <version>2.29.1</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-json-jackson</artifactId>
    <version>2.25.1</version>
</dependency>
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.8.5</version>
</dependency>
</dependencies>
</project>

My JDK is zulu18.28.13-ca-jdk18.0.0-macosx_aarch64 and the build target is java 1.8. Some suggested that this a firewall issue but I am on my home network so no specific firewall will block the traffic. The same project worked on my Windows computer but got the error when imported to my Mac Book Pro.

I also tried to manually create the project and then converting it to Maven project but still getting the same error.

My Eclipse is Version: 2022-03 (4.23.0)

Anyone know the causes and how to fix this? I am not to familiar with the OpenJava/Apple silicon world.

Thanks


Solution

  • Added maven-jar-plugin 3.3.0 and it worked.