[maven-3] Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4

Thanks to a Dropwizard Maven archetype I generated a sample Dropwizard Maven project. The pom.xml notably uses maven-source-plugin:

<plugin>
    <artifactId>maven-source-plugin</artifactId>
    <version>2.4</version>
    <executions>
        <execution>
           <id>attach-sources</id>
           <goals>
              <goal>jar</goal>
           </goals>
        </execution>
    </executions>
</plugin>

When I run "clean install" I have the following error :

Plugin org.apache.maven.plugins:maven-source-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4: Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:2.4 from/to central (http://repo.maven.apache.org/maven2): Connection refused: connect -> [Help 1]

The "maven-source-plugin" dependency is stored in the Nexus repository of my company. So I tried the adding of the plugin dependency between dependencies and /dependencies :

<dependencies>
    ...
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.4</version>
    </dependency>
</dependencies>

but it did not correct the problem. I also tried to add the dependency at the call of the plugin :

 <plugin>
    <artifactId>maven-source-plugin</artifactId>
    <version>2.4</version>
    <executions>
       <execution>
           <id>attach-sources</id>
           <goals>
              <goal>jar</goal>
           </goals>
       </execution>
      </executions>
      <dependencies>
          <dependency>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-source-plugin</artifactId>
              <version>2.4</version>
          </dependency>
     </dependencies>
 </plugin>

but it did not work either

This question is related to maven-3

The answer is


so I am assuming that this project you are doing in your private eclipse (not company provided eclipse where you work). The same problem I resolved just as below

quick fix : got to .m2 file --> create a backup of settings.xml --> remove settings.xml --> restart your eclipse.


Remove the content of the folder \.m2\repository\org\apache\maven\plugins\maven-resource-plugin\2.7. The cached info turned out to be the issue.


I am using JDK 7 for maven project and I used -Dhttps.protocols=TLSv1.2 as argument in JRE. It has allowed to download all maven repository which were failing earlier.


On my side it was coming from an error in my settings.xml file. I had a bad tag. Just removed it, refreshed and i was good to go.


It may happen, e.g. after an interrupted download, that Maven cached a broken version of the referenced package in your local repository.

Solution: Manually delete the folder of this plugin from cache (i.e. your local repository), and repeat maven install.

How to find the right folder? Folders in Maven repository follow the structure:

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <version>2.4</version>
</dependency>

is cached in ${USER_HOME}\.m2\repository\org\apache\maven\plugins\maven-source-plugin\2.4


org.apache.maven.plugins:maven-source-plugin does not exist in the repository http://repo.maven.apache.org/maven2.

You have to download it from Maven central where it exists => maven-source-plugin

Verify your pom definition or your settings.xml file.


Update the apache-maven-3.5.0-bin\apache-maven-3.5.0\conf\settings.xml file.

Check your internet explorer proxy --> Setting --> Internet explorer -->Connection --> LAN Setting

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>user</username>
  <password>****</password>
  <host>proxy</host>
  <port>8080</port>
</proxy>


I use intelliJ and finally I created my own settings.xml and added the following content structure to it. In my project's pom.xml, the nexus repositories were defined but for some reason it was always hitting the external apache maven repo which is blocked in my company.

<settings>
  <mirrors>
     <id>nexus</id>
     <url>nexusURL </url>
     <mirrorOf>central</mirrorOf>
    <mirror>

<profiles>
  <profile>
    <repositories>
      <repository>

</settings>