If you don't want to create two different projects, you may want to create two different gradle profiles, using the apply from: feature from Gradle.
For each webapp instance, ninja and warrior, you must create a script file with all the information specific for the profile.
In these new gradle build files, ninja-profile.gradle and warrior-profile.gradle, you can set the specific configurations that differ from ninja to warrior, which in this case could be:
- Resources folder: you can create a separated resources folder for each of the instances
- Jetty configuration: if you want to run two different instances of the 2 webapps, each of them in a separated jetty instance.
In your "main" build file you define everything that is common for all profile and build needs, plus you add the following line:
apply from: "${profile}-profile.gradle"
When you run Gradle you can pass the name of the profile using the -P option:
$ gradle -Pprofile=ninja tasks
or
$ gradle -Pprofile=warrior tasks