Maven skip tests

0 votes

I have been using Maven 2.2.1 and to build my project I used this command

mvn clean install -Dmaven.test.skip=true

However, the build failed saying it couldn't find one of the artifacts. However, when I used:

mvn clean install -DskipTests

Everything worked fine and since then, I have been thinking that these 2 commands are equivalent. However, the link seems to suggest that -Dmaven.test.skip=true also skips compiling the test cases. However, that still didn't explain to me why one command is working and another is not. It will be great if anyone please explain this to me.

Feb 10 in Others by Soham
• 9,670 points

1 answer to this question.

0 votes

You have correctly pointed out that the -Dmaven.test.skip=true will skip compiling the tests. This will also skip building the test artifacts like you mentioned. However, a common practice for large projects is to have testing utilities and various base classes shared among modules in the same project. The code below is accomplished by having a module require a test-jar of a previously built module:


If the -Dmaven.test.skip=true has been elaborately stated, then test-jars aren't built, and any module that relies on them will fail to build obviously. Following that, once you use -DskipTests, Maven does not run the tests, but it does compile them and build the test-jar, making it available for the subsequent modules.

answered Feb 10 by Rahul
• 9,680 points

Related Questions In Others

0 votes
1 answer
0 votes
1 answer

Maven in Eclipse: step by step installation

There are steps noted in order to ...READ MORE

answered Feb 18 in Others by Aditya
• 7,660 points
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 votes
1 answer
0 votes
1 answer

How to skip tests in PHPunit?

Hello, The fastest and easiest way to skip ...READ MORE

answered Nov 10, 2020 in PHP by Niroj
• 82,800 points
0 votes
3 answers

Can we run selenium tests (Firefox) on WebDriver without a GUI?

Hi ,  Yes, you can use headless browsers ...READ MORE

answered Sep 2, 2020 in Selenium by Sri
• 3,190 points
0 votes
2 answers

How can we take screenshots of tests in Selenium 2 using C#

Hey, try using following code command to ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,120 points
+4 votes
2 answers

Jenkins not showing Maven Release Plugin

Make your project type Maven Project. This ...READ MORE

answered Oct 11, 2018 in DevOps Tools by Hannah
• 18,570 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP