GitHub: gradle-publish-pluginjava
A flex gradle plugin for publish your library to maven repository become easy.android
for Gradle version >= 2.1:git
plugins {
id "com.whl.gradle-publish-plugin" version "0.1.16-SNAPSHOT"
}
複製代碼
for Gradle version < 2.1 or where dynamic configuration is required:github
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.whl:gradle-publish-plugin:0.1.16-SNAPSHOT"
}
}
apply plugin: "com.whl.gradle-publish-plugin"
複製代碼
Also see it in Gradle pluginsapi
"com.whl.gradle-publish-plugin" should be after apply "java-library" or "com.android.library"app
then, configuration in your build.gradle,such as:maven
simple example:flex
group 'com.example'
version '1.0-SNAPSHOT'
gradlePublish {
releaseRepository {
url = "http://your repository.com/nexus/content/repositories/releases"
userName = "your release account"
password = "your release account"
}
}
複製代碼
complete example:gradle
group 'com.example'
version '1.0-SNAPSHOT'
gradlePublish {
sourceJarEnabled = true
javaDocEnabled = true
signEnabled = false
releaseRepository {
url = "http://your repository.com/nexus/content/repositories/releases"
userName = "your release account"
password = "your release account"
}
snapshotRepository {
url = "http://your repository.com/nexus/content/repositories/snapshots"
userName = "your snapshot account"
password = "your snapshot account"
}
}
複製代碼
last, execute ./gradlew publish
task to publish your library to specified maven repositoryui