Gradle not able to resolve dependencies from a private maven repo hosted on s3 - Getting a 403: Forbidden status


(Shubham Goyal) #1

I have hosted a private maven repo on s3. I am trying to use it in my gradle script like this

repositories {
    maven {
        url = 'http://my-mvn-repo.s3.amazonaws.com/snapshots'
        credentials {
            username 'mys3username'
            password 'mys3accesskey'
        }
    }
}

And my dependency as this -

dependencies {
    compile 'com.example:MyProject:1.2-SNAPSHOT'
}

But I am getting this error while executing the script -

> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not resolve com.example:MyProject:1.2-SNAPSHOT.
     Required by:
         com.example:ApplicationProject:1.2-SNAPSHOT
      > Unable to load Maven meta-data from http://my-mvn-repo.s3.amazonaws.com/snapshots/com/example/MyProject/1.2-SNAPSHOT/maven-metadata.xml.
         > Could not GET 'http://my-mvn-repo.s3.amazonaws.com/snapshots/com/example/MyProject/1.2-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden

I guess Gradle is not utilizing the s3 credentials for accessing the files. Generally accessing private s3 files through HTTP require making private/signed urls like this - http://stackoverflow.com/a/8819466/2522556

Is there any workaround I can do for now ?