Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven - How to compile tests without running them ?

Tags:

maven

Is there a way in Maven to compile the tests without running them ? I want to use the IDE to run specific tests and not all of them.

like image 204
user373201 Avatar asked Jan 22 '11 15:01

user373201


People also ask

How do you skip the tests when running a Maven package command?

To skip running the tests for a particular project, set the skipTests property to true. You can also skip the tests via the command line by executing the following command: mvn install -DskipTests.

Does mvn compile run tests?

mvn compile: Compiles source code of the project. mvn test-compile: Compiles the test source code. mvn test: Runs tests for the project. mvn package: Creates JAR or WAR file for the project to convert it into a distributable format.

What is Maven test Skip?

In Maven, you can define a system property -Dmaven. test. skip=true to skip the entire unit test. By default, when building project, Maven will run the entire unit tests automatically. If any unit tests is failed, it will force Maven to abort the building process.


2 Answers

How about the test-compile lifecycle phase? It doesn't require any test skipping, because it occurs before the test phase. I.e.,

$ mvn test-compile 

And done.

Introduction to the Build Lifecycle explains further.

like image 164
RonU Avatar answered Sep 29 '22 07:09

RonU


To just compile the tests and code, without running them, just do:

mvn test-compile 
like image 40
orange77 Avatar answered Sep 29 '22 08:09

orange77