Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

maven-3

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

like image 382
Denis Avatar asked Jan 11 '17 10:01

Denis


1 Answers

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

like image 153
user3002512 Avatar answered Oct 11 '22 15:10

user3002512