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

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




5 Answers
5



Two possible situations :



Your company uses a proxy to connect to the public Maven repository. Then ask someone in your company what the IP address of the proxy is then put it in your settings.xml file



Your company has its/their own Maven repository/ies (Nexus repository for example). Then ask someone in your company what the Nexus repository is then put it in your pom.xml or in your settings.xml. See Adding maven nexus repo to my pom.xml and https://maven.apache.org/guides/mini/guide-multiple-repositories.html



Update the apache-maven-3.5.0-binapache-maven-3.5.0confsettings.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>





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


org.apache.maven.plugins:maven-source-plugin



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


maven-source-plugin



Verify your pom definition or your settings.xml file.



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.


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>






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Help:Category

How can temperature be calculated given relative humidity and dew point?

I have a recursive function to validate tree graph and need a return condition