问题
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?)?
回答1:
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.
回答2:
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.
回答3:
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.
来源:https://stackoverflow.com/questions/34828426/disable-javadoc-check-for-bintray-upload