Sources root mistakenly being marked as resources root
Hi,
We are working on framework support plugin (CUBA).
Sporadically our team and end users encountering the following issue. Module source root of the Gradle (CUBA) project is being additionally marked as resources root.
Our plugin is working with project classes and there are no classes in such broken modules. So it's functionality becomes unavailable.
Here is the content element from system/external_build_system\<project>.<module>.main.xml
<content url="file://$MODULE_DIR$/../../../../modules/web/src">
<sourceFolder url="file://$MODULE_DIR$/../../../../modules/web/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../modules/web/src" type="java-resource" />
</content>
After removing this resource folders everything is fine, even after reimporting.
Unfortunately there are no known steps to reproduce the issue. But it happens on different projects.
We don't even sure that it is our plugin causing the issue. There is no functionality in our plugin that implicitly manages sources and resources roots.
IDEA Community 2019.1.3
Are there any ideas what can cause such behavior?
Please sign in to leave a comment.
>We don't even sure that it is our plugin causing the issue. There is no functionality in our plugin that implicitly manages sources and resources roots.
>Are there any ideas what can cause such behavior?
Does it happen only when you are running IDE with your plugin?
With Gradle-based projects IDE uses the configuration from build.gradle script when configures the structure for project: dependencies, source/resource roots.
How do you configure this source/resource roots in Gradle? Btw for Gradle-based projects it is recommended to use Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Create separate module per source set option. Do you use it?
The `cuba-gradle` plugin sets same directory for sources and resources. Obviously, Idea-gradle import does not handle this case well. Would you mind opening an issue in our tracker?
Hi, thanks for your replies.
Yes, Create separate module per source set option is enabled by default.
The `cuba-gradle` plugin sets same directory for sources and resources. But for the 99.9% cases it doesn't cause any trouble. The issue is quite rare with yet unknown steps to reproduce.
As I found in com.intellij.openapi.externalSystem.service.project.manage.ContentRootDataService#createSourceRootIfAbsent:284, resources folder just won't be added if there is sources folder with the same path. I guess that there is another place, where that conflicting folder being added.
The YouTrack issue: https://youtrack.jetbrains.com/issue/IDEA-218855
Thank you! Let's continue working on this in the YouTrack.
Had the same problem.
Solution for me: disable "Android (support)" plugin in Intellij idea.