Reputation: 337
I am using Eclipse Buildship plugin for executing Gradle tasks on my project. Any idea how to exclude the test task when the build task is run? In Gradle STS plugin, I used to update the Program arguments to '-x test' which skipped the test task. When I tried the same with Buildship, getting the below error.
* What went wrong:
Task ' test' not found in root project
Upvotes: 1
Views: 2679
Reputation: 1
Try adding -x and :test in two separate lines in Program Arguments section in Run Configurations
Upvotes: 0
Reputation: 4196
In the build file add code to exclude test classes that are not to run.
If you exclude all your test classes, then it effectively is "skipping" the test step. Well, really the test step "runs" but no tests will run.
This is also handy while developing, but some tests are for dev work only, to be tidied up later. It also gives a good hint (or reminder) to other developers where to find operational dev tests.
// include this in your build.gradle file,
// and update the package selector lines
test {
// The excluded classes won't be called by the test step.
// They're for manual calls during devwrk only.
exclude 'devonly/sometests/**'
exclude '**/Bar.class'
}
Upvotes: 0
Reputation: 93
For me. I had to put '-x' and 'test' on separate lines for BuildShip to work.
Upvotes: 0
Reputation: 28071
Have you considered running the "assemble" task instead of "build"?
:build
+--- :assemble
| \--- :jar
| \--- :classes
| +--- :compileJava
| \--- :processResources
\--- :check
\--- :test
+--- :classes
| +--- :compileJava
| \--- :processResources
\--- :testClasses
+--- :compileTestJava
| \--- :classes
| +--- :compileJava
| \--- :processResources
\--- :processTestResources
Upvotes: 4