Project: clover
Issue CLOV-1144: Support *.groovy files in src/main/java folder for groovy-eclipse-plugin
*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:* {noformat} [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 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) org.apache.maven.cli.MavenCli.main(MavenCli.java:141) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 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 com.atlassian.maven.plugin.clover.internal.instrumentation.AbstractInstrumenter.instrumentSources(AbstractInstrumenter.java:197) com.atlassian.maven.plugin.clover.internal.instrumentation.AbstractInstrumenter.instrument(AbstractInstrumenter.java:72) com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo.execute(CloverInstrumentInternalMojo.java:309) com.atlassian.maven.plugin.clover.CloverSetupMojo.execute(CloverSetupMojo.java:31) org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 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...] {noformat} 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
Story points: 3