Here is the simplified structure of each module of my project :
src
|- main
|- java
<My classes>
|- resources
config.properties
|- test
|- java
MainTest
|- resources
I recently updated IntelliJ to version 2019.2. As Jetbrains removed the "uncheck create separate modules per source set" (see this post), when I import a Gradle project, I end up with one module having two sub-modules : main
and test
.
So, in Intellij project structure, I have this :
main sub-module
test sub-module
In some class, I load the config.properties
file this way :
InputStream inputStream = MyClass.class.getClassLoader().getResourceAsStream("config.properties");
But when I run MainTest.main()
in IntelliJ, which at some point calls the bit of code above, the resulting InputStream is null.
I guess that the test
module classpath doesn't include the main
resources folder...
How can I fix that ?
When I could check the box "uncheck create separate modules per source set", I had just one module, with one classpath, and my life was easier...
Is there a way, maybe using Gradle configuration in build.gradle
file, to enforce one unique module/source set ?