Skipping a systemTest task for a specific submodule

Hello.

I have a gradle project with a set of subprojects that all have a systemTest taks defined by the root project:

subprojects {
    ...
    task systemTest(type: Test, dependsOn: [jar, undeployFeature, deployFeature, waitForServerReady]) {
        testClassesDir = sourceSets.systemTest.output.classesDir
        classpath = sourceSets.systemTest.runtimeClasspath
        systemProperties['jar.path'] = jar.archivePath
   }
   ...
}

There is just one of my subprojects that does not have a “feature” that can be deployed to the server and system tested. So I would like to skip system test for that module. All I have been able to come up with is to add

onlyIf { project.hasFeature } // project.hasFeature is set for each subproject.

to the systemTest task and all the dependencies. Is there a more elegant way. Where I can skip a task without having to add onlyIf’s to all the dependencies?

Best regards
Søren

systemTest.enabled = false

Place that in the subproject’s build.gradle file, and it will mark the task as SKIPPED when the build runs.

1 Like