Reputation: 21480
I have a repo which contains three gradle projects, as well as a number of other resources, like a JavaScript SPA, build scripts, etc; something like this;
/my-app
/services
/gradle-service-1
/gradle-service-2
/gradle-service-3
/frontend
/build
/integration-tests
I'd like to set up intelliJ so that the three gradle services were recognised as modules, but still see the rest of my code -- all the non-Java parts -- in the same window.
So something like this;
/my-app
/services
/gradle-service-1 [gradle]
/gradle-service-2 [gradle]
/gradle-service-3 [gradle]
/frontend
/build
/integration-tests
So that when I do Build | Build Project
in the menu, it builds all three gradle projects.
Thing is, I can't figure out how to create this kind of 'nested' intellij structure, where the main repo is visible, and certain subfolders are Java projects. Is there any way to set this up?
I would also be happy if I could see the gradle projects to the side, so long as I can build them, run tests, etc;
/gradle-service-1 [gradle]
/gradle-service-2 [gradle]
/gradle-service-3 [gradle]
/my-app [web]
...
Upvotes: 1
Views: 1573
Reputation: 21480
Turns out that intellij has a sensible block on Java modules nested inside Java modules, but no such prohibition for putting Java modules inside Web modules.
So you can update your .idea/my-project.iml
file and change the type;
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4"> <!-- HERE - was type="JAVA_MODULE"
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Upvotes: 2