I made a question on stack overflow yesterday on h...
# gradle
m
I made a question on stack overflow yesterday on how to run a command after a certain gradle task is killed? (https://stackoverflow.com/q/69877187/9248718)
p
You really shouldn't call gradle from gradle. Instead, configure tasks in the order they should run
m
Unfortunately I need to start up the database and the ktor server at the same time and furthermore the source code watcher
h
Idk the specific tasks, but are you sure you can not just write three tasks, have your umbrella task depend on them, use some mustRunAfter and finalizedBy and that works?
n
You could use a build service to start the server
m
I think it's pretty straightforward what I am trying to achieve but let me clarify in case I didn't explain myself enough: I have three tasks: 1. dev-db: Spawns the process that starts docker-compose with my database service 2. run: It starts ktor server in development mode so it watches for changes on build/classes and build/resources 3. watch: a wrapper over
./gradlew build -t
so the run task hot-reloads code once there's a change. I wanted to have a single task that launches these three processes together and once that I Ctrl+C out of the terminal; to kill these three child processes. With Make I'd do something like the following:
Copy code
dev-db_bg:
  docker-compose -f docker-compose.dev.yml up &
watch_bg:
  ./gradlew build -t &

start-dev: dev-db_bg watch_bg
  ./gradlew run
and then just
make start-dev
Im a bit of a gradle noob if you haven't noticed yet 😛
Turns out all that is needed is passing the
--no-daemon
flag
p