It looks like you want to only build the root project. Just like you can refer to the subproject tasks with ‘subproject:task’, you can refer to the root project by its name (’:’, just a colon). So if you want to just build the root project, you can do:
./gradlew :build
This doesn’t do exactly what you want because we’re still running tests.
With a regular Java project, build is nothing more than assemble and check. assemble is just jar and check is just test.
So I think you can get what you want with:
./gradlew :assemble
If you have something else under ‘check’ (e.g., checkstyle) that you also want to run, but still skip test, you can do this (in build.gradle):
// in root project
task miniBuild(dependsOn: [ ':assemble', ':checkstyle' ])
and use it as you initially wanted:
./gradlew miniBuild
If you’re going to add a custom task, it would be helpful to include a description and put it under a group, so developers can find it easily via ‘tasks’. e.g.:
// in root project
task miniBuild(group: "Quick", dependsOn: [ ':assemble', ':checkstyle' ]) {
description = "Runs a quick build"
}