Could not find artifact org.apache.maven.plugins:maven-resources-plugin

Nele picture Nele · Jul 5, 2019 · Viewed 12.6k times · Source

I'm trying to build maven project, but not at all its working fine.

Here is my POM.xml

    <<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.Data.Maven</groupId>
  <artifactId>Hadoop</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
    <dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.5</version>
   </dependency>
  </dependencies>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.1.0</version>
        </plugin> 
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.4</version>
        </plugin>  
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.5</version>
        </plugin>                 
      </plugins>
    </pluginManagement>   
</build>
</project>

setting.xml

<repositories>
   <repository>
      <id>cloudera</id>
      <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
      <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
         <enabled>true</enabled>
      </snapshots>
   </repository>
   <repository>
      <id>central</id>
      <url>http://repo.maven.apache.org/maven2/</url>
   </repository>
   <repository>
      <id>forplay-legacy</id>
      <url>http://forplay.googlecode.com/svn/mavenrepo</url>
   </repository>
   <repository>
      <id>org.apache.maven.plugins</id>
      <url>https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin</url>
   </repository>
   <repository>
      <id>org.apache.maven.plugins</id>
      <url>https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin</url>
   </repository>
</repositories>

Error

[ERROR] Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

Error says its not able to download artifact from http://repo.maven.apache.org/maven2 url, but am not downloading this url. I've mentioned different in setting.xml.

Is there any way to solve this problem or I could change any setting so that it dont go to this url http://repo.maven.apache.org/maven2 to download but the one mentioned in setting.xml ?

Tried almost all options, like deleting maven repository, mvn install, force updates, deleting project, re-starting eclipse etc etc.

Any help would be appreciated . Really Stuck

Thanks

Answer

Mureinik picture Mureinik · Jul 5, 2019

In maven's semantic versioning, 3.1 and 3.1.0 are not the same thing. Maven't can't locate version 3.1 for this plugin simply because it does not exist. You need to refer to the 3.1.0 version you correctly referred to in the dependencies:

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.1.0</version> <!-- Here, instead of 3.1 you had in the question -->
      </plugin>           
    </plugins>
  </pluginManagement>   
</build>