This is a gradle plugin, publish aar lib to maven repo.
-
website: https://intbird.net/
-
maven: https://intbird.net/maven/
-
coding: https://blog.csdn.net/intbird
buildscript {
repositories {
maven { url "https://intbird.net/maven/" }
}
}
dependencies {
classpath "net.intbird.soft.gradle:publish-maven:$lastVersion"
}
apply plugin: 'publish-maven'
android {
...
}
publishConfig {
groupId = '$package-name'
artifactId = '$lib-name'
version = "$version"
// if you want publish to your own repository, mdf the flow config
repoSnapshot = "https://intbird.net/maven/snapshots/"
repoRelease = "https://intbird.net/maven/releases/"
repoName = "repo_user"
repoPassword = "repo_password"
}
./gradlew publishReleasePublicationToMavenRepository
see change log has release history.
dependencies {
classpath "net.intbird.soft.gradle:publish-maven:$lastVersion"
}
mvnrepository:
https://mvnrepository.com/artifact/org.gradle.api.plugins
https://developer.android.com/reference/tools/gradle-api/7.3/com/android/build/api/dsl/LibraryPublishing https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/PublishingOptions#summary
android {
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
multipleVariants {
withSourcesJar()
withJavadocJar()
allVariants()
}
}
}
https://docs.gradle.org/6.0/userguide/publishing_maven.html#publishing_maven:complete_example
plugins {
id 'java-library'
}
publishing {
publications {
release(MavenPublication) {
// Applies the component for the release build variant.
from components.release
artifact java.withJavadocJar()
artifact java.withSourcesJar()
}
}
}
DefaultJavaPluginExtension javaLibraryPlugin = project.extensions.getByType(DefaultJavaPluginExtension)
publication.artifact(javaLibraryPlugin.withJavadocJar())
publication.artifact(javaLibraryPlugin.withSourcesJar())