Deploying Maven dependencies to S3: No connector available

后端 未结 4 2213
慢半拍i
慢半拍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:



        
相关标签:
4条回答
  • 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 https://github.com/spring-projects/aws-maven/issues/25#issuecomment-112031441.

    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 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.

    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.

    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.

    0 讨论(0)
提交回复
热议问题