Edd grant created MCOMPILER-165:
-----------------------------------

             Summary: Child modules don't seem to be able to use a different 
compilerId to their parent modules when built from the parent POM.
                 Key: MCOMPILER-165
                 URL: https://jira.codehaus.org/browse/MCOMPILER-165
             Project: Maven 2.x Compiler Plugin
          Issue Type: Bug
    Affects Versions: 2.3.2
            Reporter: Edd grant


I have a mixed Java/ Groovy project which is split over several Maven modules, 
all of which have a common parent module. In the parent POM I specify some 
basic common options for the {{maven-compiler-plugin}} (see example 1 below). 
The idea being that in my child modules I can either simple use this 
configuration by specifying the plugin with no further configuration (example 
2), or I can override this configuration if I have specific requirements (for 
example switching the {{compilerId}}) (example 3).

Example 1 - Parent POM:
{code}
<pluginManagement>
  <plugins>
     <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.3.2</version>
      <configuration>
        <source>1.6</source>
        <target>1.6</target>
      </configuration> 
    </plugin>
  </plugins>
</pluginManagement>
{code} 

Example 2 - Child POM that inherits the parent POM's plugin configuration:
{code}
<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
</plugin>
{code}

Example 3 - Child POM that specifies a different compilation configuration 
(uses the {{groovy-eclipse-compiler}}) to the parent POM's  configuration:
{code}
<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <compilerId>groovy-eclipse-compiler</compilerId>
    <verbose>true</verbose>
    <source>1.6</source>
    <target>1.6</target>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-eclipse-compiler</artifactId>
      <version>2.6.0-01</version>
    </dependency>
  </dependencies>
</plugin>
{code}

Using this configuration everything works fine if I build ({{mvn clean 
install}}) each POM individually, however when I build the project from the 
parent POM compilation of the module with the switched {{compilerId}} fails and 
 I get the following error:

{code}
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] No such compiler 'groovy-eclipse-compiler'.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: No such compiler 
'groovy-eclipse-compiler'.
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at 
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: No such compiler 
'groovy-eclipse-compiler'.
        at 
org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:339)
        at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more

{code}

Would be most grateful if someone could look at this as it's causing us a lot 
of pain. Also interested to know if there are any workarounds or quick fixes in 
the meantime? Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to