Disable javadoc check for Bintray upload
Asked Answered
A

3

5

I am trying to upload a new version of my library to Bintray, however I am getting errors.

One of the changes I made was to add a custom attribute to my Javadoc. For example:

/**
 * The method does something.
 *
 * @param myParameter This is my parameter
 * @see #anotherMethod(int)
 * @attr ref R.styleable#MyLibrary_anAttribute
 */

The custom attribute tag I added was @attr ref which would show related XML attributes when generating Javadoc HTML (like in Android Developer documentation). I added this as a custom tag in my IDE (Android Studio), but it causes an error when uploading to Bintray. Also, I am using the novoda bintray plugin - here is part of my build.gradle.

apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

...

publish {
    ...
}

So when I run the following command in terminal:

gradlew bintrayUpload -PbintrayUser=me -PbintrayKey=key -PdryRun=false

I get the following error:

:mylibrary:compileDebugJavaWithJavac UP-TO-DATE      
:mylibrary:mavenAndroidJavadocs
C:\Users\...\ALibraryFile.java:216: error: unknown tag: attr
 * @attr ref R.styleable#MyLibrary_anAttribute

...

13 errors                                             
:mylibrary:mavenAndroidJavadocs FAILED          

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mylibrary:mavenAndroidJavadocs'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): 'C:\Users\...\build\tmp\mavenAndroidJavadocs\javadoc.options'

* Try:        
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED  

Total time: 12.711 secs

Is there any way round this (e.g. disabling this javadoc check?)?

Arnulfoarny answered 16/1, 2016 at 15:3 Comment(1)
It seems like disabling JavaDoc generation is just masking the problem. I was able to find the error using ./gradlew javadoc. See this answer.Acroterion
A
8

I managed to solve my issue by adding the following into my project's build.gradle:

allprojects {
    tasks.withType(Javadoc) {
        options.addStringOption('Xdoclint:none', '-quiet')
        options.addStringOption('encoding', 'UTF-8')
    }
}

I found my answer from this comment on a GitHub issue - you can also view the GitHub commit that resolved the issue.

Arnulfoarny answered 27/3, 2016 at 21:36 Comment(0)
R
6

I don't think this is the best way but it works for me. Add

    tasks.withType(Javadoc).all {
    enabled = false
    }

to your build.gradle.

Recapitulate answered 29/7, 2017 at 12:20 Comment(0)
G
2

The Javadoc artifacts is one of the artifacts created by the default Maven publication, which is created by the plugin.
The plugin documentation explain how to create a custom publication. You can use this option in order to create a custom publication which will not include a javadoc artifact or change the way the Javadoc is generated.

Gatha answered 21/1, 2016 at 8:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.