Can't download Javadoc for projects hosted in WSL with Gradle

已回答

I'm working on a Java project which I host in WSL Ubuntu. The root path of the project is then, in IntelliJ  : \\wsl.localhost\Ubuntu\home\{myUsername} . The terminal also successfully opens directly in WSL.

My main issue is I can't download the Javadoc with gradle. I'm getting this error message

Included build /wsl.localhost/Ubuntu\\wsl.localhost\Ubuntu\home\raph\OpenSearch\doc-tools\missing-doclet has build path :missing-doclet which is the same as included build /home/raph/OpenSearch/doc-tools/missing-doclet

To reproduce, simply checkout  https://github.com/opensearch-project/OpenSearch  and host it on WSL, then try downloading the Javadoc (I do it by clicking the Gradle button on the IDE on the left, then OpenSearch > OpenSearch (root) > modules (or any subproject in fact) > Tasks > documentation > javadoc (although I imagine there can be a simpler command line)).

Also, when building the project, for example running ./gradlew localDistro on https://github.com/opensearch-project/OpenSearch , I often get a message saying ‘Duplicate content roots detected’ which is maybe related to the way IntelliJ integrates with WSL as well.

I can provide the IDE logs if needed.

0
正式评论

Hi Ralph2, thank you for reaching out, and apologies for the delay!

The first issue you mentioned is a known problem tracked under IDEA-319295.

The Gradle javadoc task you’re running doesn’t download Javadoc; it actually generates Javadoc for the current project. If you’re looking to get the documentation for your project’s dependencies, you can click Download Sources in the Gradle tool window.

Regarding the Duplicate content roots detected message, this may simply indicate a minor mismatch between IntelliJ IDEA and Gradle project models. Could you let us know if you notice any actual problems or unexpected behavior caused by this message Thanks!

You’re encountering a known issue that occurs when IntelliJ, Gradle, and WSL use mixed path formats. The error appears because IntelliJ recognizes your project files under the Windows network path (\\wsl.localhost\Ubuntu\...), while Gradle running inside WSL recognizes the same files under the native Linux path (/home/raph/...). This causes Gradle to believe the same included build exists twice, leading to the “included build has the same build path” error. The “Duplicate content roots detected” message in IntelliJ is another symptom of this mismatch, as the IDE tries to index the same files from both the Windows and WSL paths. To fix this, you should open the project directly from within the WSL file system rather than through the Windows path. The safest way is to start IntelliJ from inside your WSL terminal using the command idea . (after installing IntelliJ’s WSL integration). This ensures both IntelliJ and Gradle use consistent Linux paths, preventing duplication and allowing Gradle tasks like Javadoc generation or local builds to run correctly.  
E-ZPassMA

0

If they are effectively the same, it's an IntelliJ integration problem. As far as I could gather, the recommend way of working with WSL is to install IntelliJ and create the folders directly in WSL (as explained by Yuri Trukhin here). 

Can you expand a little on how to open IntelliJ from WSL with only a . command? I didn't find resources to set it up. 

By the way, I am also aware it's doable by installing the Gateway but 1) This is agains what Yuri recommands above and against the official recommandations 2) In the same Reddit answer it says it's unstable.

0

请先登录再写评论。