Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 'java' Plugin #3

Open
JakeWharton opened this issue Dec 2, 2013 · 2 comments
Open

Support 'java' Plugin #3

JakeWharton opened this issue Dec 2, 2013 · 2 comments

Comments

@JakeWharton
Copy link

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.

@zugaldia
Copy link

zugaldia commented Apr 2, 2016

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.

@AlexanderLS
Copy link

AlexanderLS commented Jul 19, 2018

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants