Create module using command line


In IntelliJ you can create a new module using this interface:

It should give this result:

However, I have no idea on how to do the exact same thing using the Linux command line.
I tried to search it on Google (result) but in the Gradle documentation they’re editing a lot of files etc but not giving a command… I don’t understand anything of it.

This is my current structure using gradle init:
├── build.gradle
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └──
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
├── main
│ └── java
│ └──
└── test
└── java

7 directories, 9 files

How can I add those sub-projects/modules (called 1_herhaling in the pictures) using the Gradle command in the Linux command line interface?


This is functionality entirely provided by IntelliJ. It is not calling a Gradle command.

Just creating a module is very simple though. You only have to add include '1_herhaling' to settings.gradle.

Everything else is optional, but you’ll probably want to add the 1_herhaling folder right away as well.

You don’t necessarily need a build.gradle file as your root build.gradle file could configure your subproject. That’s stylistically up to you.

You may want src/main/java, src/main/resources, src/test/java, and src/test/resources, but you don’t need to create all of them if you don’t have code for all of them. Anything beyond the settings.gradle addition are implementation details for your module, not anything to do with adding the module itself. The IntelliJ feature just adds templated items that you may want, but don’t necessarily need.