Gradle plugin for managing authentication of upload tasks
Java Shell Groovy
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Version 2.0

Gradle plugin facilitating publishing to authenticated Maven repositories without adding credential information directly in the build file or in random properties files. Support for applying authentication information from Maven's settings.xml file is provided out-of-the-box.

Applying plugin

To apply the plugin, simply specify:

apply plugin: 'maven-publish-auth'

The plugin class is, whose purpose is really just to create an instance each of


These handlers get attached to tasks of type org.gradle.api.tasks.Upload and org.gradle.api.publish.maven.tasks.PublishToMavenRepository, respectively.

But in either case, both ultimately delegate to any instances configured with the Currently there is only one supported implementation, which parses the Maven settings.xml file and makes those authentication credentials available to Gradle. This includes support for Maven "encrypted" passwords as outlined at

By default, settings.xml is loaded from its default location (~/.m2/settings.xml). You can alter this by specifying -Dmaven.settings=your/path.

Support for the new Gradle Publication DSL

One of the new (and still ongoing and incubating) developments in Gradle is the new Publication DSL as the means for declaring how your project artifacts are pulished. See the Gradle UserGuide for more information.

The "bridge" between Maven authentication credentials and Gradle is the repository id. For an example, lets assume you have a Maven settings.xml that defines the following credentials:


As you can see, we have credentials associated with a repository server with the identifier of "dogdeball-repo". This is the information we need supply in order for the plugin to make the connection. In the Publication DSL, this corelates to the name attribute of the repository configuration:

publishing {
    repositories {
        maven {
            name = 'dogdeball-repo'
            url ''

Support for legacy Gradle publishing (Upload task)

If you prefer to stick with the legacy publishing DSL, I have left support of that in place for the time being too. Again, the bridge is the repository id.

uploadArchives {
    repositories.mavenDeployer {
        repository(id: 'dogdeball-repo', url: '')