Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable javadoc check for Bintray upload

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

like image 716
Farbod Salamat-Zadeh Avatar asked Jan 16 '16 15:01

Farbod Salamat-Zadeh


2 Answers

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.

like image 101
Farbod Salamat-Zadeh Avatar answered Oct 24 '22 08:10

Farbod Salamat-Zadeh


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.

like image 6
Kyaw San Oo Avatar answered Oct 24 '22 08:10

Kyaw San Oo