Source Root changes to Test Root automatically with the Gradle + Java Project

Answered

I have a multi-module project with inter dependencies. Every time I re-import the project in IntelliJ or restart, The src/test/java Folder in the core 'Rest Module' , changes from 'Source Root' -- ' Tests' in the Project Structure. Every time I set that manually in the project structure. But it restores to previous. 
This results in the other modules ' Route and Client' cannot find the dependencies in the cucumber step defs which are in the 'Rest Module'.

example of the structure:

1. Rest Module . (core module is the main module with some has some java and test code. With model class dependencies on the other modules Route and Client) 
Structure : 
>build.gradle 
>src --- 
-->main 
-->test // all the java code is here in the src/test/Java folder 
-->java 
--> resources 

2. Route Module 
Structure : 
>build.gradle 
>src --- 
-->main // all the java code is here in the src/main/Java folder 
-->java 
--> resources 
-->test 

3. Client Module ( same as Route Module)

0
1 comment
sourceSets {
    main {
        java {
            srcDirs = ['src/test/java']
        }
    }
}
0

Please sign in to leave a comment.