Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Kotlin android library mavenAndroidJavadocs task fail #71

Closed
busylee999 opened this issue Dec 11, 2015 · 19 comments
Closed

Kotlin android library mavenAndroidJavadocs task fail #71

busylee999 opened this issue Dec 11, 2015 · 19 comments

Comments

@busylee999
Copy link

I try to publish my android library on Kotlin using bintray-release plugin and feared followed error:

javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/info/InfoEntry.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/info/ObjectInfo.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/info/preferences/BooleanPreferenceInfo.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/info/preferences/FloatPreferenceInfo.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/info/preferences/IntPreferenceInfo.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/info/preferences/LongPreferenceInfo.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/info/preferences/PreferenceInfo.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/info/preferences/StringPreferenceInfo.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/mutable/BooleanMutable.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/mutable/MutableEntry.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/mutable/SetStringMutableEntry.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/ui/DevPanelActivity.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/ui/InfoListAdapter.kt" javadoc: error - Illegal package name: "/Users/busylee/work/DevPanel/devpanellib/src/main/kotlin/com/busylee/devpanel/ui/PanelLinearListView.kt" 14 errors :devpanellib:mavenAndroidJavadocs FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':devpanellib:mavenAndroidJavadocs'.

    Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/busylee/work/DevPanel/devpanellib/build/tmp/mavenAndroidJavadocs/javadoc.options'

@kollway-app
Copy link

you can try add the followed code to ignore checking javadoc's error(add these code into build.gradle file):

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

hope it helps you.

@busylee999
Copy link
Author

It did not help, same error. Any ideas?

@BennyWang
Copy link

I face the same problem, How can I skip the javadoc task for kotlin sources

@busylee999
Copy link
Author

Have you tried to exclude explicit tasks?

@busylee999
Copy link
Author

... -x mavenAndroidJavadocs ... helps me
you can read more about skipping tasks here http://www.practicalgradle.org/blog/2010/10/skipping-tasks/

@BennyWang
Copy link

thank you very much

farbodsz added a commit to farbodsz/UsefulViews that referenced this issue Mar 27, 2016
farbodsz added a commit to farbodsz/UsefulViews that referenced this issue Mar 27, 2016
Resolves #26.
(Answer found from: novoda/bintray-release#71 (comment))

Also updates version to 2.0.1
@asarazan
Copy link

asarazan commented Jun 7, 2016

I'm not an expert in the gradle api, but I fixed this in my personal .gradle files like this:

task javadoc(type: Javadoc) {
    excludes = ['**/*.kt'] // < ---- Exclude all kotlin files from javadoc file.
    // ...
}

@xrigau
Copy link
Contributor

xrigau commented Sep 9, 2016

This is a problem in the Javadoc generation itself and not in this plugin, many suggestions in this thread work, for me adding this to the library build.gradle file worked well

tasks.withType(Javadoc) {
    options.addBooleanOption('Xdoclint:none', true)
}

from: http://stackoverflow.com/questions/34874175/disable-all-javadoc-in-gradle

Thanks all for your input.

@xrigau xrigau closed this as completed Sep 9, 2016
@ebnbin
Copy link

ebnbin commented May 31, 2017

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.

Hope it helps.

@BoxResin
Copy link

BoxResin commented Jul 8, 2017

@ebnbin It worked for me!

SmasSive pushed a commit to AdevintaSpain/Barista that referenced this issue Aug 28, 2017
SmasSive pushed a commit to AdevintaSpain/Barista that referenced this issue Aug 28, 2017
SmasSive added a commit to AdevintaSpain/Barista that referenced this issue Aug 30, 2017
* Add Kotlin to Barista! 🎉

* Add checkDrawable assertion

* Add sample tests

* Add README new assertion

* Add instrumentation test to check BitmapComparator

* Upgrade Barista version

* Revert version upgrade

* Simplify tests

* FIX findbugs violation. The generated object bytecode by Kotlin is not findbugs friendly :(

* Exclude Kotlin classes from javadoc due to generation error. More info at: novoda/bintray-release#71

* Exclude lint from javadoc. More info at: novoda/bintray-release#71

* Move javadoc exclusion from quality to library gradle

* The last one?

* Match previous comments style

* Improve reader (and Roc) productivity by adding more info to comments

* Improve method readability by specifying the body instead of returning a long block of code

* Move ic_barista from mipmap to drawable
@adam-hurwitz
Copy link

adam-hurwitz commented Sep 17, 2017

@ebnbin your solution worked! Thank you!!!

@BennyWang, @asarazan, @xrigau I tried inserting your code in my project level build.gradle, but unfortunately having the same issue.

@busylee999 Unfortunately your link from December 25, 2015 above no longer works. http://www.practicalgradle.org/blog/2010/10/skipping-tasks/.

@briansalvattore
Copy link

@ebnbin worked!! Ty

@hanggrian
Copy link

I'm just wondering here, is dokka in any way supposed to fix this issue?

@rifqimfahmi
Copy link

After doing @ebnbin solution, i clean & rebuild my project and it worked. Thank you!!

@erikhuizinga
Copy link

It seems this issue has become a place to discuss problems with Kotlin and androidJavadocs... 😹

@hendraanggrian Yes, dokka can fix the problem if you disable androidJavadocs and let dokka create docs for all languages in you project (e.g. Java and Kotlin). It can also create Javadoc, if you want you documentation to look just like if you just have Java.

However, in my particular project I have problems with the generation of Javadocs, but nothing breaking; it just takes a long time to generate the docs compared to androidJavadocs: 3 minutes vs. 10 seconds.

So, can it replace androidJavadocs: yes. Does it replace it with flair and grace: no.

@nirukk52
Copy link

@asarazan
Its giving me this Cannot add task ':<...>:javadoc' as a task with that name already exists.

@StefMa
Copy link
Contributor

StefMa commented Aug 12, 2018

The thing is that dokka generated javadoc/kdoc can't be displayed in IntelliJ somehow.
I don't know why but the issue is described here.
Meaning if you don't publish your sources and generate the javadoc via dokka, the consumer of your lib will not be see the javadoc in IntelliJ.

@kronos317
Copy link

I have tried all solutions what explained above comments.
But I am getting error like below:

...
> Task :library-kt-beta:javadoc FAILED
javadoc: error - Illegal package name: "....\xxxManager.kt"
javadoc: error - Illegal package name: "....\xxxActivity.kt"
javadoc: error - Illegal package name: "....\xxxFragment.kt"
javadoc: error - Illegal package name: "....\xxxObject.kt"
...
7 errors


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':library-kt-beta:javadoc'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '....\library-kt-beta\build\tmp\javadoc\javadoc.options'

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

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
37 actionable tasks: 33 executed, 4 up-to-date

@JhoanesFreitas
Copy link

@ebnbin worked! Thanks!

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

No branches or pull requests