Friday, December 18, 2015

Deploy a jar file to Maven repository in Gradle

To deploy a jar file to Maven repository in Gradle,

add the following configuration to `build.gradle`:

apply plugin: 'maven'

repositories {
    mavenLocal()
    jcenter()
    maven { url "http://repo.izeye.com:8080/repository/internal" }
}

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "http://repo.izeye.com:8080/repository/internal") {
                authentication(userName: "admin", password: "1234")
            }
        }
    }
}

If you encounter the following error:

Could not find metadata :test/maven-metadata.xml in remote (http://repo.izeye.com:8080/repository/internal)

make sure you added it to `repositories`.

Reference:
https://docs.gradle.org/current/userguide/maven_plugin.html

No comments:

Post a Comment