title: Configuring IntelliJ to Use Groovy Compiler Instead of Java Compiler
body: <p>In my maven project, I'm currently mixing my Java code with some Groovy code. I'm using Groovy mostly to construct the beans at this point. Some of my Java code uses the Groovy beans directly.</p>
  
  <p>I configured the Maven Compiler Plugin like this:-</p>
  
  <pre><code>&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.1&lt;/version&gt;
      &lt;configuration&gt;
          &lt;compilerId&gt;groovy-eclipse-compiler&lt;/compilerId&gt;
          &lt;source&gt;${jdk.version}&lt;/source&gt;
          &lt;target&gt;${jdk.version}&lt;/target&gt;
      &lt;/configuration&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
              &lt;artifactId&gt;groovy-eclipse-compiler&lt;/artifactId&gt;
              &lt;version&gt;2.8.0-01&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
              &lt;artifactId&gt;groovy-eclipse-batch&lt;/artifactId&gt;
              &lt;version&gt;2.1.5-03&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>When I run my testcases using <code>mvn test</code>, it works just fine.</p>
  
  <p>However, when I run the testcases directly from IntelliJ by right clicking the test file and run it, I'm getting "cannot find symbol" errors on the Groovy beans. When I read the error log, IntelliJ uses Java compiler to compile my project before running the test... thus, the tests fail.</p>
  
  <p>I can't seem to figure out how to instruct IntelliJ to always use the Groovy compiler instead of Java compiler. </p>
  
  <p>What should I change under SDK so that Groovy compiler will be used? I tried adding Groovy related JAR files, but I got other errors.</p>
  
  <p><img src="https://i.stack.imgur.com/I9puH.png" alt="enter image description here"></p>
  
  <p><strong>UPDATE 1: Per @Seagull suggestion</strong></p>
  
  <p>I added groovy JARs under "Global Libraries":-</p>
  
  <p><img src="https://i.stack.imgur.com/fCLZJ.png" alt="enter image description here"></p>
  
  <p>When I executed the test file directly from IntelliJ, I'm getting some Groovy warnings and I still get the same error:-</p>
  
  <p><img src="https://i.stack.imgur.com/mrB2c.png" alt="enter image description here"></p>
  
  <p>Thanks. </p>