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

Jens Schauder

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?

Rene Groeschke

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Gradle how to publish a gradle-plugin to maven central

gradle maven plugin - how to customise maven upload's archive name

Can Gradle upload different artifacts to different Maven repos?

How can I download Maven artifacts within a plugin?

Maven: how can I deploy two artifacts with the release plugin?

How to upload maven plugin to Github packages?

gradle to maven plugin conversion

How can I build a Gradle plugin with Maven

How can I get Maven to stop attempting to check for updates for artifacts from a certain group from maven-central-repo?

Does the Android Gradle plugin support loading native libraries via Maven?

Azure Artifacts Feed is much slower than maven central

Maven central repository: Any friendly way to browse artifacts?

Publish kotlin multiplatform library to Maven Central (InvalidMavenPublicationException multiple artifacts with the identical ...)

maven-javadoc-plugin overwrites central repository

Close and release artifact on maven central using gradle

Publish an aar file to Maven Central with Gradle not working

Convert Maven `maven-assembly-plugin` to Gradle

Configuring maven plugin with Gradle Kotlin

Using a Gradle Plugin in Maven project

How to select the GnuPG key that the maven-gpg-plugin uses to sign artifacts?

How to publish proguard JAR as Maven Artifact using Gradle Publish Plugin

gradle-release plugin + maven publishing plugin

How to upload an artifact to Maven Central with an empty javadoc jar (or empty sources jar), because of no Java code nor resources?

Maven: How are artifacts built if they have their own dependencies?

How to deploy only zip artifacts in maven

How to debug Maven plugin?

How to run a selected suiteXmlFile via maven surefire plugin

Nexus can not access configured Proxy Repositories such as Maven Central

How do I get maven artifacts into the Jenkins maven repository?