Reputation: 440
if I run maven on the command line:
mvn clean install -DskipTests
this actually works and it skips the tests, but if I do it in eclipse, it still always runs the tests
<plugins>
<!-- Maven Assembly Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<excludes>
<exclude>**/UTest*.java</exclude>
</excludes>
<maven.test.skip>true</maven.test.skip>
<skipTests>true</skipTests>
<!-- get all project dependencies -->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest> <mainClass>com.example.MyMainClass/mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
So I tried three different ways, all shown above:
1) <skipTests>true</skipTests>
2) <maven.test.skip>true</maven.test.skip>
3) <excludes>...</excludes>
Within eclipse it will always run the tests
Upvotes: 1
Views: 9068
Reputation: 11411
The assembly plugin does not run the tests. Maven Works through lifecycle phases. The install
phase will trigger (not exhaustive) compiler-plugin, surefire, failsafe, assembly.
More information here, What are Maven goals and phases and what is their difference?
The surefire plugin handles the running of unit tests, to completely skip tests you can add the following to your plugins configuration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
Failsafe is an Integration Test runner.
Upvotes: 2