简体   繁体   中英

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

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?

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")
            }
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM