title: Using GMavenPlus to run spock groovy tests alongside java junit tests from maven surefire
body: <p>I am trying to run &quot;spock groovy tests alongside java junit tests from maven surefire&quot;</p>
  <p>I followed the examples</p>
  <ul>
  <li><a href="https://github.com/groovy/GMavenPlus/wiki/Examples#joint-compilation" rel="nofollow noreferrer">https://github.com/groovy/GMavenPlus/wiki/Examples#joint-compilation</a> &amp;</li>
  <li><a href="https://github.com/groovy/GMavenPlus/wiki/Usage#configuring-gmavenplus-1" rel="nofollow noreferrer">https://github.com/groovy/GMavenPlus/wiki/Usage#configuring-gmavenplus-1</a></li>
  </ul>
  <p>When I have the gmavenplus + groovy plugins defined in the pom, the groovy test runs but not the java test.</p>
  <p>When I have the gmavenplus + groovy plugins removed from the pom, the java test runs but not the groovy test.</p>
  <p>The files I have are</p>
  <ul>
  <li><p>src/main/java/org/gw/JavaClass.java</p>
  <pre><code> package org.gw;
  
   public class JavaClass {
   }
  </code></pre>
  </li>
  <li><p>src/test/java/org/gw/JavaTest.java</p>
  <pre><code> package org.gw;
  
   import org.junit.Test;
  
   public class JavaTest {
  
       @Test
       public void testMethod1() {
           System.out.println(&quot;testMethod1&quot;);
       }
   }
  </code></pre>
  </li>
  <li><p>src/test/groovy/org/gw/GroovyTest.groovy</p>
  <pre><code> package org.gw
   import spock.lang.Specification
   import spock.lang.Unroll
  
   @Unroll
   class GroovyTest extends Specification {
  
       def 'do a spock test'() {
           when:
           def doa = &quot;spock test&quot;
  
           then:
           println(&quot;done a &quot; + doa)
       }
   }
  </code></pre>
  </li>
  <li><p>pom.xml</p>
  <pre><code> &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
   &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
            xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
            xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
       &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
       &lt;groupId&gt;org.gw&lt;/groupId&gt;
       &lt;artifactId&gt;mcve&lt;/artifactId&gt;
       &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
       &lt;properties&gt;
           &lt;groovy.version&gt;3.0.3&lt;/groovy.version&gt;
       &lt;/properties&gt;
  
       &lt;dependencies&gt;
  
           &lt;dependency&gt;
               &lt;groupId&gt;junit&lt;/groupId&gt;
               &lt;artifactId&gt;junit&lt;/artifactId&gt;
               &lt;version&gt;4.13&lt;/version&gt;
               &lt;scope&gt;test&lt;/scope&gt;
           &lt;/dependency&gt;
  
           &lt;dependency&gt;
               &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
               &lt;artifactId&gt;groovy&lt;/artifactId&gt;
               &lt;version&gt;${groovy.version}&lt;/version&gt;
           &lt;/dependency&gt;
  
           &lt;dependency&gt;
               &lt;groupId&gt;org.spockframework&lt;/groupId&gt;
               &lt;artifactId&gt;spock-core&lt;/artifactId&gt;
               &lt;version&gt;2.0-M3-groovy-3.0&lt;/version&gt;
           &lt;/dependency&gt;
  
       &lt;/dependencies&gt;
  
       &lt;build&gt;
           &lt;plugins&gt;
               &lt;plugin&gt;
                   &lt;!-- The gmavenplus plugin is used to compile Groovy code. To learn more about this plugin,
                   visit https://github.com/groovy/GMavenPlus/wiki --&gt;
                   &lt;groupId&gt;org.codehaus.gmavenplus&lt;/groupId&gt;
                   &lt;artifactId&gt;gmavenplus-plugin&lt;/artifactId&gt;
                   &lt;version&gt;1.10.0&lt;/version&gt;
                   &lt;executions&gt;
                       &lt;execution&gt;
                           &lt;goals&gt;
                               &lt;goal&gt;addSources&lt;/goal&gt;
                               &lt;goal&gt;addTestSources&lt;/goal&gt;
                               &lt;goal&gt;generateStubs&lt;/goal&gt;
                               &lt;goal&gt;compile&lt;/goal&gt;
                               &lt;goal&gt;generateTestStubs&lt;/goal&gt;
                               &lt;goal&gt;compileTests&lt;/goal&gt;
                               &lt;goal&gt;removeStubs&lt;/goal&gt;
                               &lt;goal&gt;removeTestStubs&lt;/goal&gt;
                           &lt;/goals&gt;
                       &lt;/execution&gt;
                   &lt;/executions&gt;
               &lt;/plugin&gt;
               &lt;plugin&gt;
                   &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                   &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                   &lt;version&gt;3.8.1&lt;/version&gt;
               &lt;/plugin&gt;
               &lt;plugin&gt;
                   &lt;!-- if including source jars, use the no-fork goals
                        otherwise both the Groovy sources and Java stub sources
                        will get included in your jar --&gt;
                   &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                   &lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;
                   &lt;!-- source plugin \&gt; = 2.1 is required to use the no-fork goals --&gt;
                   &lt;version&gt;3.2.1&lt;/version&gt;
                   &lt;executions&gt;
                       &lt;execution&gt;
                           &lt;id&gt;attach-sources&lt;/id&gt;
                           &lt;goals&gt;
                               &lt;goal&gt;jar-no-fork&lt;/goal&gt;
                               &lt;goal&gt;test-jar-no-fork&lt;/goal&gt;
                           &lt;/goals&gt;
                       &lt;/execution&gt;
                   &lt;/executions&gt;
               &lt;/plugin&gt;
  
               &lt;plugin&gt;
                   &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                   &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                   &lt;version&gt;3.0.0-M5&lt;/version&gt;
               &lt;/plugin&gt;
  
           &lt;/plugins&gt;
       &lt;/build&gt;
   &lt;/project&gt;
  </code></pre>
  </li>
  <li><p>My Output is</p>
  <pre><code> [INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ mcve ---
   [INFO] 
   [INFO] -------------------------------------------------------
   [INFO]  T E S T S
   [INFO] -------------------------------------------------------
   [INFO] Running org.gw.GroovyTest
   done a spock test
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.164 s - in org.gw.GroovyTest
   [INFO] 
   [INFO] Results:
   [INFO] 
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
  </code></pre>
  </li>
  </ul>