Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure maven install to skip tests by default?

Tags:

maven-2

maven

I was wondering if it's possible to configure maven to skip unit tests by default.

like image 911
David García González Avatar asked Nov 08 '12 16:11

David García González


2 Answers

In the settings.xml file, inside the properties tag, add this property: maven.test.skip to true.

    <profiles>
         <profile>
              <id>development</id>
              <properties>
                  <maven.test.skip>true</maven.test.skip>
              </properties>
         </profile>
    </profiles>

    <activeProfiles>
         <activeProfile>development</activeProfile>
    </activeProfiles> 

If the, you want to execute this tests, you can override the property:

mvn clean install -Dmaven.test.skip=false
like image 155
David García González Avatar answered Sep 30 '22 17:09

David García González


You can do this by adding a profile element to the settings.xml file:

<profile>
    <id>skip.tests.by.default</id>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
        <maven.test.skip>true</maven.test.skip>
    </properties>
</profile>
like image 25
Tuna Avatar answered Sep 30 '22 17:09

Tuna