I’m a new Gradle user and I’d like to discuss my plan and get some feedback from you. I feel like I’m currently having a wrong understandment of Gradle regarding my idea.
I’d like to develop a software application which consists of multiple standalone applications. I found that Gradle supports multi-project builds but if I understand it correctly the multi-project build has only one “Main application”. The other subprojects can only be libraries. Is that correct?
My application consists of e.g. 3 standalone modules. I’d like to use gradle for the automatic testing etc. and when I use the run task I’ve imagined that Gradle will start up all 3 applications. Another reason is to only maintain one Git repository which contains the gradle root project with all it’s subprojects.
I appreciate your feedback and hints.
Edit: I forgot to mention that I’m trying to build a Java Application.
That is incorrect. You can have as many application or library subprojects as you need.
FYI, the standard Gradle application plugin’s run task is blocking. If you want to start all 3 in parallel, you’ll probably want to create your own startup script that executes/manages them as background processes. This startup script could certainly be written in groovy/java/etc as a Gradle task.
Thank you for your reply.
You are correct. I keep reading and reading but somehow (as a new user) I’m overwhelmed by the informations I’m reading.
Reading your answer it feels like i need to understand the plugins and tasks better.
Could you tell me, what’s the best way to add new subprojects to a multi-project?
First I thought using gradle init is a good way e.g. First create a multi-project build and to add another subproject create a directory inside the root and inside the new folder do another gradle init (and then configure the settings etc.).
Now I feel like simply adding a new folder with the predefined structure and simply placing a build.gradle is the better / correct way?
This is a common issue I hear from new Gradle users. Gradle is very flexible and with that comes complexity and a reasonably steep learning curve IMO. Just know that you’re not alone, many others have struggled as well
I have never used gradle init, I always manually create the necessary directory structure and files. Some people may find gradIe init useful, but since I have no experience I cannot recommend whether or not to use it.