title: IntelliJ: Specifying different groovyc version for source and test within same module
body: <p>I am using <code>IntelliJ 11.1.3</code>, <code>IvyIDEA Plugin for IntelliJ</code>, <code>Spock 0.5</code> (which depends on <code>Groovy 1.8.4</code>), and <code>Groovy 1.5.6</code>.</p>
  
  <p>I have an IntelliJ module that follows <a href="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html" rel="nofollow">Maven Standard Directory Layout</a>.  The output is a WAR file.</p>
  
  <p>When doing a build of this module in IntelliJ, is there any way that I can tell IntelliJ to use the following: </p>
  
  <ul>
  <li><code>Groovy 1.5.6</code> to compile <code>src/main/groovy</code> </li>
  <li><code>Groovy 1.8.4</code> to compile <code>src/test/groovy</code></li>
  </ul>
  
  <p>I need to do this because the actual application code needs to be compiled against <code>Groovy 1.5.6</code> (long story short: the WAR that is generated is deployed with an EAR that must stay on <code>Groovy 1.5.6</code> for now).</p>
  
  <p>The Test directory, of course, does not get deployed with the WAR.  The Test directory contains Spock Tests.  I am using Spock 0.5, which requires <code>Groovy 1.8.x</code></p>
  
  <p><strong>ivy.xml</strong> </p>
  
  <pre><code>&lt;dependency conf="compile-&gt;default" name="groovy-all" 
      org="org.codehaus.groovy" rev="1.5.6"/&gt;
  
  &lt;dependency conf="test-&gt;default" name="groovy-all" 
      org="org.codehaus.groovy" rev="1.8.4"/&gt;
  &lt;dependency conf="test-&gt;default" name="spock-core" 
      org="org.spockframework" rev="0.5-groovy-1.8"/&gt;
  </code></pre>
  
  <p>I need to be able to run tests from IntelliJ.  If I build from IntelliJ and attempt to run a Spock Test, I get the following:</p>
  
  <pre><code>org.spockframework.runtime.InvalidSpecException: 
  Specification 'org.myorg.test.ProcessCaseTest' was not compiled properly 
  (Spock AST transform was not run); try to do a clean build
  at org.spockframework.runtime.SpecUtil.checkIsSpec(SpecUtil.java:53)
  </code></pre>
  
  <p>If I remove this line: </p>
  
  <pre><code>&lt;dependency conf="compile-&gt;default" name="groovy-all" 
      org="org.codehaus.groovy" rev="1.5.6"/&gt;
  </code></pre>
  
  <p>then I can build and run Spock Tests, but I lose Groovy from my module.  </p>
  
  <p>I think what I need to do is tell IntelliJ to use one version of Groovy to compile the application code and another version of Groovy to compile the tests, but I have not been able to find a way to do this. </p>
  
  <p>I would be extremely grateful for any help or insight that anyone could provide.  Thank you very much.</p>