Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying Maven dependencies to S3: No connector available

I'm trying to use Amazon S3 to host my Maven artifacts. I've added the following to my pom.xml:

<distributionManagement>
    <repository>
        <id>maven.xxx.com-release</id>
        <name>AWS S3 Release Repository</name>
        <url>s3://maven.xxx.com/release</url>
    </repository>
    <snapshotRepository>
        <id>maven.xxx.com-snapshot</id>
        <name>AWS S3 Snapshot Repository</name>
        <url>s3://maven.xxx.com/snapshot</url>
    </snapshotRepository>
</distributionManagement>

<build>
    <extensions>
        <extension>
            <groupId>org.springframework.build</groupId>
            <artifactId>aws-maven</artifactId>
            <version>5.0.0.RELEASE</version>
        </extension>
    </extensions>
</build>

This is working fine and my snapshot is stored on S3. Now I'm trying to reference the artifact in another project:

<repositories>
    <repository>
        <id>maven.xxx.com-release</id>
        <name>AWS S3 Release Repository</name>
        <url>s3://maven.xxx.com/release</url>
    </repository>
    <repository>
        <id>maven.xxx.com-snapshot</id>
        <name>AWS S3 Snapshot Repository</name>
        <url>s3://maven.xxx.com/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<build>
    <extensions>
        <extension>
            <groupId>org.springframework.build</groupId>
            <artifactId>aws-maven</artifactId>
            <version>5.0.0.RELEASE</version>
        </extension>
    </extensions>
</build>

When I run $ mvn deploy -X, I get the following error:

Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T15:51:42+02:00)
Maven home: /usr/local/Cellar/maven/3.2.2/libexec
Java version: 1.8.0_11, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.4", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/local/Cellar/maven/3.2.2/libexec/conf/settings.xml
[DEBUG] Reading user settings from /Users/philipp/.m2/settings.xml
[DEBUG] Using local repository at /Users/philipp/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/philipp/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Skipped remote update check for com.xxx:parent-pom:1.4.11-SNAPSHOT/maven-metadata.xml, locally installed metadata up-to-date.
[DEBUG] Skipped remote update check for com.xxx:parent-pom:1.4.11-SNAPSHOT/maven-metadata.xml, locally installed metadata up-to-date.
[DEBUG] Skipped remote update check for com.xxx:parent-pom:1.4.11-SNAPSHOT/maven-metadata.xml, locally installed metadata up-to-date.
[DEBUG] java.util.NoSuchElementException
      role: org.apache.maven.wagon.Wagon
  roleHint: s3
org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
      role: org.apache.maven.wagon.Wagon
  roleHint: s3
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:264)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:252)
    at org.eclipse.aether.internal.connector.wagon.PlexusWagonProvider.lookup(PlexusWagonProvider.java:33)
    at org.eclipse.aether.connector.wagon.WagonRepositoryConnector.lookupWagon(WagonRepositoryConnector.java:337)
    at org.eclipse.aether.connector.wagon.WagonRepositoryConnector.<init>(WagonRepositoryConnector.java:157)
    at org.eclipse.aether.connector.wagon.WagonRepositoryConnectorFactory.newInstance(WagonRepositoryConnectorFactory.java:159)
    at org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider.newRepositoryConnector(DefaultRepositoryConnectorProvider.java:139)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:531)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:436)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:295)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:171)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:224)
    at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:903)
    at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:755)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:309)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:452)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:421)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:385)
    at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:663)
    at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:654)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:243)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.util.NoSuchElementException
    at org.eclipse.sisu.plexus.RealmFilter$FilteredItr.next(RealmFilter.java:118)
    at org.eclipse.sisu.plexus.RealmFilter$FilteredItr.next(RealmFilter.java:1)
    at org.eclipse.sisu.plexus.DefaultPlexusBeans$Itr.next(DefaultPlexusBeans.java:76)
    at org.eclipse.sisu.plexus.DefaultPlexusBeans$Itr.next(DefaultPlexusBeans.java:1)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:260)
    ... 34 more
[DEBUG] Writing tracking file /Users/philipp/.m2/repository/com/xxx/parent-pom/1.4.11-SNAPSHOT/parent-pom-1.4.11-20140722.193312-1.pom.lastUpdated
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM com.xxx:parent-pom:1.4.11-SNAPSHOT: Could not transfer artifact com.xxx:parent-pom:pom:1.4.11-20140722.193312-1 from/to maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot): No connector available to access repository maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot) of type default using the available factories WagonRepositoryConnectorFactory and 'parent.relativePath' points at wrong local POM @ line 9, column 10

    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:405)
    at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:663)
    at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:654)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:243)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]   
[ERROR]   The project com.xxx:base:1.3.2-SNAPSHOT (/Users/philipp/Documents/IntelliJ/base/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM com.xxx:parent-pom:1.4.11-SNAPSHOT: Could not transfer artifact com.xxx:parent-pom:pom:1.4.11-20140722.193312-1 from/to maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot): No connector available to access repository maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot) of type default using the available factories WagonRepositoryConnectorFactory and 'parent.relativePath' points at wrong local POM @ line 9, column 10 -> [Help 2]
org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact com.xxx:parent-pom:pom:1.4.11-20140722.193312-1 from/to maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot): No connector available to access repository maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot) of type default using the available factories WagonRepositoryConnectorFactory
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:175)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:224)
    at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:903)
    at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:755)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:309)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:452)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:421)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:385)
    at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:663)
    at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:654)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:243)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact com.xxx:parent-pom:pom:1.4.11-20140722.193312-1 from/to maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot): No connector available to access repository maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot) of type default using the available factories WagonRepositoryConnectorFactory
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:295)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:171)
    ... 22 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact com.xxx:parent-pom:pom:1.4.11-20140722.193312-1 from/to maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot): No connector available to access repository maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot) of type default using the available factories WagonRepositoryConnectorFactory
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:546)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:436)
    ... 26 more
Caused by: org.eclipse.aether.transfer.NoRepositoryConnectorException: No connector available to access repository maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot) of type default using the available factories WagonRepositoryConnectorFactory
    at org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider.newRepositoryConnector(DefaultRepositoryConnectorProvider.java:193)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:531)
    ... 27 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Could not transfer artifact com.xxx:parent-pom:pom:1.4.11-20140722.193312-1 from/to maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot): No connector available to access repository maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot) of type default using the available factories WagonRepositoryConnectorFactory and 'parent.relativePath' points at wrong local POM

So I can write artifacts (the credentials are obviously correct) but not read them? I must be overlooking something simple, but I can't really find it.

like image 232
xeraa Avatar asked Jul 22 '14 19:07

xeraa


2 Answers

I couldn't get rid of the exception No connector available to access repository maven.xxx.com-snapshot (s3://maven.xxx.com/snapshot) of type default using the available factories WagonRepositoryConnectorFactory. The reason is, that I'm using a remote / stand-alone <parent> POM and Maven seems to try to load that first and only add extensions afterwards. That's why the error is happening.

So, I needed to fall back to HTTP(S). However, I don't want to make my artifacts public, which rules out S3's static website hosting. Instead I'm using http://www.s3auth.com, which provides HTTP basic auth and is working great.

The only thing to watch out for:

  • You upload via the S3 wagon — so you need those credentials in your settings.xml.
  • You download via HTTP — so you need the basic auth credentials in your settings.xml as well.
  • Therefore, I've created unique IDs for the S3 release + snapshot reference and unique IDs for the HTTP release + snapshot references.

Unfortunately, it doesn't support HTTPS at the moment, which is a major drawback.

like image 76
xeraa Avatar answered Nov 11 '22 00:11

xeraa


I have created a sample project of how to use S3 bucket as maven repository.

https://github.com/wbinglee/maven-s3-repo

From your configuration, I don't see obvious problem. You can compare your project configuration with above sample project. If you cannot find the problem, you may need to share your full pom.xml.

Other option of using S3 as maven repository is directly using http schema and configure S3 bucket as static web hosting. It's also included in above sample project with required configuration in README.

Then you can configure your maven repository configuration like below:

<repositories>
    <repository>
        <id>maven.xxx.com-release</id>
        <name>AWS S3 Release Repository</name>
        <url>http://maven.xxx.com.s3-website-ap-southeast-2.amazonaws.com/release</url>
    </repository>
    <repository>
        <id>maven.xxx.com-snapshot</id>
        <name>AWS S3 Snapshot Repository</name>
        <url>http://maven.xxx.com.s3-website-ap-southeast-2.amazonaws.com/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

Hope that helps.

like image 7
Wenbing Li Avatar answered Nov 11 '22 00:11

Wenbing Li