How to upload artifacts to maven central with gradle and the maven plugin via a proxy

302 views Asked by At

I try to upload some artifacts to maven central (well actually to the sonatyp repository) using gradle.

I set up my build file as described in this nice article

And it worked for quite some time, but now I'm sitting behind a proxy, and the only information how to configure the proxy is a snippet that there is a proxy element in the configuration and its JavaDoc

But I don't now how to actually translate that into code in my build file

I tried many variations of

uploadArchives {
    repositories {
        mavenDeployer {
            repository(...) {...}

            proxy('https://myproxy:8080'){
                authentication(userName: proxyUser, password: proxyPassword)
            }
...

But all I get are messages that no matching proxy method was found.

What is the correct syntax?

1

There are 1 answers

0
Rene Groeschke On BEST ANSWER

you're almost there. The proxy setup must be within the repository configuration block:

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url:"http://someupload.url"){
                proxy(host: "localhost", port: 8080, type: 'http', userName:"proxyusername", password:"proxypassword")
            }
        }
    }
}