James Dunn
James Dunn

Reputation: 8264

Skip tests in Jenkins

I've set up a build on Jenkins for a Maven project, and I would like to build it without running any of the tests. I've tried entering "clean install -DskipTests" in the goals field, like this:

enter image description here

But it doesn't work. What am I doing incorrectly?

Note: I want to skip the tests without touching the pom. I have a separate build that DOES run the tests.

Upvotes: 32

Views: 75345

Answers (4)

iMysak
iMysak

Reputation: 2228

Just to extend the answer, maven has 2 options for skipping tests:

-DskipTests=true — The one that was mentioned. With this parameter, maven ignores tests completely.

-Dmaven.test.skip=true — With this option maven compiles the tests but doesn't launch them.

So you may want to use the second option instead as fast code compile validation. E.G.: if you develop some library or module that will be used by some one else you must be sure that you don't brake contract with the client. Tests compilation can help you with this.

Use either of these parameters depending on your needs.

Upvotes: 14

K. Gol
K. Gol

Reputation: 1616

I use option "-DskipTests=true" in "Invoke top-level Maven target" -> "JVM Options" and it works fine.

Upvotes: 2

Raghav Tallam
Raghav Tallam

Reputation: 601

use "Goals and options" value is "clean install -DskipTests=true".

it works like a Charm. I saved hours of time using this Option. :-)

Upvotes: 3

James Dunn
James Dunn

Reputation: 8264

The problem is that I omitted =true. I was able to build without running tests by entering:

clean install -DskipTests=true

Upvotes: 61

Related Questions