Support 'java' Plugin
JakeWharton opened this issue · comments
It would be nice for projects that are mixed with both Android and plain 'ol Java modules to use the same configuration for both.
This shouldn't be too hard since you can probably just defer to the normal 'nexus' plugin for most of the heavy lifting.
Given enough time, I might implement this myself. But in case you're feeling generous I figured I'd make the issue for now.
For anyone coming from Google having this same issue, we recently had the need for a similar use-case where we wanted to publish a pure "core" Java module. All we did was to change this part:
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
into:
task coreJavadocsJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task coreSourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives coreSourcesJar
archives coreJavadocsJar
}
$ ./gradlew uploadArchives
is now working as expected.
@JakeWharton @zugaldia Support for 'java' Plugin implemented in https://github.com/Vorlonsoft/GradleMavenPush. Please read README.md before use it.
GradleMavenPush
Helper to upload Gradle Android Artifacts and Gradle Java Artifacts to Maven repositories (JCenter, Maven Central, Corporate staging/snapshot servers and local Maven repositories)