Why Don't New Gradle Projects Use Sources?


I just created a new Gradle project using the Project Wizard.

Immediately I get a popup saying:

You can configure Gradle wrapper to use distribution with sources. 

It will provide IDE with Gradle API/DSL documentation.


Why doesn't IDEA  just generate the project template using the distribution with sources by default?

Comment actions Permalink

It seems to be a regresssion, please check our issue tracker: https://youtrack.jetbrains.com/issue/IDEA-208205 .

Comment actions Permalink

That doesn't seem to be the issue.

It seems like by default IDEA generates a build.gradle that uses the binary distribution rather than one with sources.

e.g. by adding this to the build.gradle

wrapper {
distributionType = Wrapper.DistributionType.ALL
Comment actions Permalink

>Why doesn't IDEA just generate the project template using the distribution with sources by default?

Because the "all" Gradle distribution is bigger than "bin" Gradle distribution and is needed only for Gradle Groovy DSL codeinsight feature like quick documentation.
Actually there is yet another usage of Gradle with the sources - navigation through the Gradle code during debugging of the Gradle scripts.

So, initially, it was decided to delegate the choice to a user.
Now it is considered as a usability bug, the current plan is to remove the tip and suggest to download sources (or even better javadocs) separately when it's actually needed. E.g. on the first "Quick documentation" attempt inside Gradle groovy DSL. And w/o requirement to use Gradle "all" distribution for the build.

There is no any timeline for the bugfix, here is the related issue which can be used to watch the progress - https://youtrack.jetbrains.com/issue/IDEA-203597


Please sign in to leave a comment.