fresh_dev
fresh_dev

Reputation: 6774

How to configure maven install to skip tests in eclipse?

Is it possible to configure run as maven install in eclipse to skip unit tests? If so, how can it be done?

Upvotes: 55

Views: 84081

Answers (7)

Sandeep Kumar
Sandeep Kumar

Reputation: 35

  • Got to your root project and right click screenshot of the menu that opens at right click
  • Got to run as and click on run configurations
  • On the left, go to Maven Build, right click and create new
  • Choose your base project, give a name in the goals textfield, add your kind of build and add the parameters -DskipTests=true -Dmaven.test.failure.ignore=truescreenshot of the build parameters window

An example of a maven build goal to skip tests is: clean install -DskipTests=true -Dmaven.test.failure.ignore=true.

Upvotes: 0

Tom Elliott
Tom Elliott

Reputation: 1116

  1. Ensure Maven is configured for your project
  2. Right-click on your project
  3. Go to 'Run As'
  4. Select 'Run Configurations'
  5. In the left-hand column, right-click 'Maven Build' and select 'New'
  6. Select the base directory (the project) you want to build from
  7. Write 'install' and any other goals you want in the 'Goals' field
  8. Click the 'Skip Tests' radio button
  9. Click Run!

Upvotes: 110

Alison Graham
Alison Graham

Reputation: 41

Putting this in my Pom.xml turned off the tests for me - but at maven build, not at maven install.

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
            <excludes>
               <exclude>**/*Test.java</exclude>
            </excludes>
        </configuration>
</plugin>

Upvotes: 0

Saeed
Saeed

Reputation: 616

accordig to maven's document you can write this in you pom.xml:

<project>


[...]
<build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.12</version>
    <configuration>
      <skipTests>true</skipTests>
    </configuration>
  </plugin>
</plugins>

Upvotes: 7

grueny
grueny

Reputation: 91

You can put the property maven.test.skip in a profile in your pom. And then you activate this profile in eclipse in the project properties of maven in eclipse.

Upvotes: 5

mishadoff
mishadoff

Reputation: 10789

It depends on maven test plugin that you use. You can try add parameter -Dmaven.test.skip=true to your build configuration.

Upvotes: 5

Zolt&#225;n Ujhelyi
Zolt&#225;n Ujhelyi

Reputation: 13858

At the Run configurations there is a Maven Build type of Run configuration. At that you could set up the standard Maven skipTests parameter.

Upvotes: 1

Related Questions