Deploying Maven dependencies to S3: No connector available

后端 未结 4 1692
慢半拍i 2021-02-20 16:40

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

  • 2021-02-20 17:00

    If like me you're getting this message due to using a remote parent POM and Maven trying to load it before adding extensions (and therefore not being able to read s3://), see

    Doing this fixes it for me and allows me to keep parent remote and have maven still resolve it via s3 url and IAM permissions.

    0 讨论(0)
  • 2021-02-20 17:08

    I couldn't get rid of the exception No connector available to access repository (s3:// 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, 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.

    0 讨论(0)
  • 2021-02-20 17:08

    Since Maven 3.3.1 you can simply create a file named ${maven.projectBasedir}/.mvn/extensions.xml. This will be loaded first and works like a charme. See this answer or directly check the release notes for further details.

    0 讨论(0)
  • 2021-02-20 17:19

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

    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:

            <name>AWS S3 Release Repository</name>
            <name>AWS S3 Snapshot Repository</name>

    Hope that helps.

    0 讨论(0)