Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1144

Support *.groovy files in src/main/java folder for groovy-eclipse-plugin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 3.1.12
    • 3.1.7
    • Groovy, Maven plugin
    • None

      Problem:

      Clover fails during instrumentation of *.groovy files in case when sources are put in src/main/java directory, instead of src/main/groovy and when the groovy-eclipse-plugin is used.

      Steps to reproduce:

      • create a project with groovy-eclipse-plugin and maven-clover2-plugin
      • put a *.groovy file inside src/main/java
      • run build

      Expected error:

      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1.201s
      [INFO] Finished at: Mon Sep 10 10:16:48 CDT 2012
      [INFO] Final Memory: 7M/18M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal com.atlassian.maven.plugins:maven-clover2-plugin:3.1.7:setup (default-cli) on project test.project: Clover has failed to instrument the source files in the [C:\workspaces\workspace\TestProject\target\clover\src-instrumented] directory -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.atlassian.maven.plugins:maven-clover2-plugin:3.1.7:setup (default-cli) on project test.project: Clover has failed to instrument the source files in the [C:\workspaces\workspace\TestProject\target\clover\src-instrumented] directory
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
      	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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Clover has failed to instrument the source files in the [C:\workspaces\workspace\TestProject\target\clover\src-instrumented] directory
      	at com.atlassian.maven.plugin.clover.internal.instrumentation.AbstractInstrumenter.instrumentSources(AbstractInstrumenter.java:197)
      	at com.atlassian.maven.plugin.clover.internal.instrumentation.AbstractInstrumenter.instrument(AbstractInstrumenter.java:72)
      	at com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo.execute(CloverInstrumentInternalMojo.java:309)
      	at com.atlassian.maven.plugin.clover.CloverSetupMojo.execute(CloverSetupMojo.java:31)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      	... 19 more
      [ERROR] 
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
        *** ERROR: No source files specified
      
        USAGE: com.cenqua.clover.CloverInstr [OPTIONS] PARAMS [FILES...]
      

      A reason is that Java compiler is involved here, Clover is called, it filters out all files which do not have *.java extension and as a consequence it passes wrong argument to CloverInstr.

      Solution:

      1) Add check to AbstractInstrumenter (maven-clover2-plugin) so it does not call CloverInstr in case no matching files are found

      2) Add support for src/main/java, src/test/java directories for Groovy - probably in GroovySourceScanner + CloverInstrumentInternalMojo

      Workaround:

      Put Groovy files in correct location i.e. src/main/groovy - they'll be handled correctly by Clover.

      Background:

      According to groovy-eclipse-plugin documentation, they recommend putting groovy files inside java folder - it's not nice, but it's the fastest set-up.

      http://groovy.codehaus.org/Groovy-Eclipse+compiler+plugin+for+Maven

              mparfianowicz Marek Parfianowicz
              mparfianowicz Marek Parfianowicz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: