Tuesday, February 26, 2013

No connector available to access repository - FIXED! - Maven Wagon

When you try to deploy artifacts to Sonatype using maven 3, If you encounter the following error, you probably have not configured Maven Wagon properly  

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.444s
[INFO] Finished at: Tue Feb 26 06:37:48 IST 2013
[INFO] Final Memory: 10M/981M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7
:deploy (default-deploy) on project test-core: Failed to deploy artifacts/metad
ata: No connector available to access repository xxx-maven2-repository (scp://x
xxx/maven2/) of type default using the available factories WagonRepositoryConne
ctorFactory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swi
tch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please re
ad the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecution
Exception

To fix this issue 
  • Add wagon extensions to your pom.
    <build>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>2.4</version>
            </extension>
        </extensions>
    </build>
  • Add distribution management segment to your pom.
    <distributionManagement>
        <repository>
            <id>xxx-maven2-repository</id>
            <name>Xxx Maven2 Repository</name>
            <url>scp://xxxx/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>xxx-maven2-snapshot-repository</id>
            <name>Xxx Maven2 Snapshot Repository</name>
            <url>scp://xxxx/snapshots/maven2/</url>
        </snapshotRepository>
    </distributionManagement>
Not it works !
For more info on using extensions refer: http://maven.apache.org/guides/mini/guide-using-extensions.html

8 comments:

  1. This post solved my problem and saved me a lot of time. Thank you for posting this very clear fix.

    ReplyDelete
    Replies
    1. where should i write this extension in pom.xml

      Delete
  2. It works from command line, but when I use the eclipse plugin (eclipse kepler) I get this error
    9/26/13, 6:13:01 PM GMT-03:00: [WARN] Could not transfer metadata xxx/maven-metadata.xml from/to xxx.net (scp://xxx:22/usr/site/opt/maven2-repo): Cannot connect. Reason: timeout: socket is not established Could not transfer metadata xxx:2.0.13-SNAPSHOT/maven-metadata.xml from/to xxx.net (scp://xxx:22/usr/site/opt/maven2-repo): Cannot connect. Reason: timeout: socket is not established
    running from command line I used apache-maven-3.1.0
    running from eclipse I set my external installation but eclipse says that it will use embedded installation to resolve dependencies. (embedded is 3.0.4)


    ReplyDelete
    Replies
    1. Have you find any solution ?
      I am also facing same issue

      Delete
  3. Thanks for the post ....saved my hours..

    ReplyDelete
    Replies
    1. where should i write this extension in pom.xml

      Delete
  4. Great post. Tried it with Maven 3.2.1 but then the mvn release:perfrom is not finishing. With Maven 3.0.4 no problem.

    ReplyDelete
  5. where should i write this extension in pom.xml

    ReplyDelete