1

Using maven-release-plugin, I have tried all possible ways I could (on command line as well), to skip compiling my tests but have not been successful so far. I want to do skip through pom. This is how my pom.xml looks

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <configuration>
            <arguments>-Dmaven.test.skip</arguments>
            <goals>deploy</goals>
          </configuration>
        </plugin>

I have tried solutions from this post: How can I get maven-release-plugin to skip my tests? but couldn't get it to work.

Tried surefire http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#skip but no luck.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.12.4</version>
  <configuration>
       <skip>true</skip>
  </configuration>
</plugin>

Please help to fix my pom.xml using maven-release-plugin preferably.

Community
  • 1
  • 1
linoox
  • 97
  • 3
  • 10

2 Answers2

2

AFAIK this can only be done on the command line by setting

-Darguments="-Dmaven.test.skip=true -DskipTests"
Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
  • is the -DskipTests option a must? – linoox Apr 08 '14 at 21:54
  • `maven.test.skip=true` skips _compiling_ the tests, `skipTests` skips _running_ the tests. – Marcel Stör Apr 09 '14 at 05:13
  • @MarcelStör No, maven.test.skip also skips running the tests: "*Set this to "true" to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you enable it using the "maven.test.skip" property, because maven.test.skip disables both running the tests and compiling the tests. Consider using the skipTests parameter instead.*" – blackbuild Apr 09 '14 at 12:35
  • @blackbuild, thanks, makes a lot more sense that way. Sorry, my memory didn't serve me right on this one. – Marcel Stör Apr 09 '14 at 13:04
0

First you need to figure out how to solve this without the maven-release-plugin. Compilation of the test-classes is done by the org.apache.maven.plugins:maven-compiler-plugin:testCompile, while the execution is done by org.apache.maven.plugins:maven-surefire-plugin:test. So it is possible, but maybe the real question is: why do you want this? Isn't this a workaround for the real cause?

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
Robert Scholte
  • 11,889
  • 2
  • 35
  • 44
  • I have some dependency issue in my tests which is failing the build, I wanted to get around that for a while to test some code changes that I have done. I am totally new to maven, the project I am working on has this pom with the test config so I thought of skipping it. – linoox Apr 08 '14 at 20:46
  • 1
    Why didn't you have used branches in your version control to get around things like this done? Apart from what Rober already mentioned. – khmarbaise Apr 09 '14 at 09:15