(gradle 3.0) ./gradlew idea doesn't add groovy as source root

not-a-bug

(Justin Uang) #1

After upgrading, src/main/groovy isn’t added as a source root in the projects generated by ./gradlew idea.

Before:

       <content url="file://$MODULE_DIR$/">
         <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false"/>
         <sourceFolder url="file://$MODULE_DIR$/src/main/groovy" isTestSource="false"/>
         <excludeFolder url="file://$MODULE_DIR$/build"/>
         <excludeFolder url="file://$MODULE_DIR$/.gradle"/>
       </content>

After:

       <content url="file://$MODULE_DIR$/">
         <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false"/>
         <excludeFolder url="file://$MODULE_DIR$/build"/>
         <excludeFolder url="file://$MODULE_DIR$/.gradle"/>
       </content>

(Jendrik Johannes) #2

Hi Justin,

Which version of Gradle did you use before?

I cannot reproduce this problem in 3.0. If I have the Groovy plugin applied and if groovy source files are present, <sourceFolder url="file://$MODULE_DIR$/src/main/groovy" isTestSource="false"/> is added.

I only noticed the that the Groovy source folder is not added if there are no groovy source file yet. However, the same behaviour already existed in 2.14.


(Justin Uang) #3

I was using 2.14 before.

I tested it out with a new project and didn’t have the issue, and then realized that we were applying the java plugin before the groovy one in the subprojects block of the root project.

We were probably getting lucky with undefined behavior before.


(Jendrik Johannes) #4

Cool. Happy to hear that you resolved your issue.