Author: olamy
Date: Wed Jan 23 21:27:46 2013
New Revision: 1437748

URL: http://svn.apache.org/viewvc?rev=1437748&view=rev
Log:
[MCOMPILER-199] Plugin 3.0 does not compile src/main/groovy if neither 
src/main/java nor src/main/resources folders exist

Modified:
    
maven/plugins/trunk/maven-compiler-plugin/src/it/groovy-project-with-new-plexus-compiler/pom.xml
    
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java

Modified: 
maven/plugins/trunk/maven-compiler-plugin/src/it/groovy-project-with-new-plexus-compiler/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/groovy-project-with-new-plexus-compiler/pom.xml?rev=1437748&r1=1437747&r2=1437748&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-compiler-plugin/src/it/groovy-project-with-new-plexus-compiler/pom.xml
 (original)
+++ 
maven/plugins/trunk/maven-compiler-plugin/src/it/groovy-project-with-new-plexus-compiler/pom.xml
 Wed Jan 23 21:27:46 2013
@@ -26,6 +26,7 @@ xsi:schemaLocation="http://maven.apache.
 
   <build>
     <sourceDirectory>src/main/groovy</sourceDirectory>
+    <testSourceDirectory>src/test/groovy</testSourceDirectory>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
@@ -35,9 +36,9 @@ xsi:schemaLocation="http://maven.apache.
           <compilerId>groovy-eclipse-compiler</compilerId>
           <verbose>true</verbose>
           <!-- see https://jira.codehaus.org/browse/MCOMPILER-199 -->
-          <includes>
+          <!--includes>
             <include>**/*.groovy</include>
-          </includes>
+          </includes-->
         </configuration>
         <dependencies>
           <dependency>

Modified: 
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java?rev=1437748&r1=1437747&r2=1437748&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
 Wed Jan 23 21:27:46 2013
@@ -81,49 +81,49 @@ public abstract class AbstractCompilerMo
      *
      * @since 2.0.2
      */
-    @Parameter ( property = "maven.compiler.failOnError", defaultValue = 
"true" )
+    @Parameter(property = "maven.compiler.failOnError", defaultValue = "true")
     private boolean failOnError = true;
 
     /**
      * Set to <code>true</code> to include debugging information in the 
compiled class files.
      */
-    @Parameter ( property = "maven.compiler.debug", defaultValue = "true" )
+    @Parameter(property = "maven.compiler.debug", defaultValue = "true")
     private boolean debug = true;
 
     /**
      * Set to <code>true</code> to show messages about what the compiler is 
doing.
      */
-    @Parameter ( property = "maven.compiler.verbose", defaultValue = "false" )
+    @Parameter(property = "maven.compiler.verbose", defaultValue = "false")
     private boolean verbose;
 
     /**
      * Sets whether to show source locations where deprecated APIs are used.
      */
-    @Parameter ( property = "maven.compiler.showDeprecation", defaultValue = 
"false" )
+    @Parameter(property = "maven.compiler.showDeprecation", defaultValue = 
"false")
     private boolean showDeprecation;
 
     /**
      * Set to <code>true</code> to optimize the compiled code using the 
compiler's optimization methods.
      */
-    @Parameter ( property = "maven.compiler.optimize", defaultValue = "false" )
+    @Parameter(property = "maven.compiler.optimize", defaultValue = "false")
     private boolean optimize;
 
     /**
      * Set to <code>true</code> to show compilation warnings.
      */
-    @Parameter ( property = "maven.compiler.showWarnings", defaultValue = 
"false" )
+    @Parameter(property = "maven.compiler.showWarnings", defaultValue = 
"false")
     private boolean showWarnings;
 
     /**
      * The -source argument for the Java compiler.
      */
-    @Parameter ( property = "maven.compiler.source", defaultValue = "1.5" )
+    @Parameter(property = "maven.compiler.source", defaultValue = "1.5")
     protected String source;
 
     /**
      * The -target argument for the Java compiler.
      */
-    @Parameter ( property = "maven.compiler.target", defaultValue = "1.5" )
+    @Parameter(property = "maven.compiler.target", defaultValue = "1.5")
     protected String target;
 
     /**
@@ -131,34 +131,34 @@ public abstract class AbstractCompilerMo
      *
      * @since 2.1
      */
-    @Parameter ( property = "encoding", defaultValue = 
"${project.build.sourceEncoding}" )
+    @Parameter(property = "encoding", defaultValue = 
"${project.build.sourceEncoding}")
     private String encoding;
 
     /**
      * Sets the granularity in milliseconds of the last modification
      * date for testing whether a source needs recompilation.
      */
-    @Parameter ( property = "lastModGranularityMs", defaultValue = "0" )
+    @Parameter(property = "lastModGranularityMs", defaultValue = "0")
     private int staleMillis;
 
     /**
      * The compiler id of the compiler to use. See this
      * <a href="non-javac-compilers.html">guide</a> for more information.
      */
-    @Parameter ( property = "maven.compiler.compilerId", defaultValue = 
"javac" )
+    @Parameter(property = "maven.compiler.compilerId", defaultValue = "javac")
     private String compilerId;
 
     /**
      * Version of the compiler to use, ex. "1.3", "1.5", if {@link #fork} is 
set to <code>true</code>.
      */
-    @Parameter ( property = "maven.compiler.compilerVersion" )
+    @Parameter(property = "maven.compiler.compilerVersion")
     private String compilerVersion;
 
     /**
      * Allows running the compiler in a separate process.
      * If <code>false</code> it uses the built in compiler, while if 
<code>true</code> it will use an executable.
      */
-    @Parameter ( property = "maven.compiler.fork", defaultValue = "false" )
+    @Parameter(property = "maven.compiler.fork", defaultValue = "false")
     private boolean fork;
 
     /**
@@ -167,7 +167,7 @@ public abstract class AbstractCompilerMo
      *
      * @since 2.0.1
      */
-    @Parameter ( property = "maven.compiler.meminitial" )
+    @Parameter(property = "maven.compiler.meminitial")
     private String meminitial;
 
     /**
@@ -176,13 +176,13 @@ public abstract class AbstractCompilerMo
      *
      * @since 2.0.1
      */
-    @Parameter ( property = "maven.compiler.maxmem" )
+    @Parameter(property = "maven.compiler.maxmem")
     private String maxmem;
 
     /**
      * Sets the executable of the compiler to use when {@link #fork} is 
<code>true</code>.
      */
-    @Parameter ( property = "maven.compiler.executable" )
+    @Parameter(property = "maven.compiler.executable")
     private String executable;
 
     /**
@@ -267,7 +267,7 @@ public abstract class AbstractCompilerMo
      *
      * @since 2.1
      */
-    @Parameter ( property = "maven.compiler.debuglevel" )
+    @Parameter(property = "maven.compiler.debuglevel")
     private String debuglevel;
 
     /**
@@ -283,13 +283,13 @@ public abstract class AbstractCompilerMo
     /**
      * The directory to run the compiler from if fork is true.
      */
-    @Parameter ( defaultValue = "${basedir}", required = true, readonly = true 
)
+    @Parameter(defaultValue = "${basedir}", required = true, readonly = true)
     private File basedir;
 
     /**
      * The target directory of the compiler if fork is true.
      */
-    @Parameter ( defaultValue = "${project.build.directory}", required = true, 
readonly = true )
+    @Parameter(defaultValue = "${project.build.directory}", required = true, 
readonly = true)
     private File buildDirectory;
 
     /**
@@ -316,13 +316,13 @@ public abstract class AbstractCompilerMo
      *
      * @since 2.5
      */
-    @Parameter ( defaultValue = "${reuseCreated}", property = 
"maven.compiler.compilerReuseStrategy" )
+    @Parameter(defaultValue = "${reuseCreated}", property = 
"maven.compiler.compilerReuseStrategy")
     private String compilerReuseStrategy = "reuseCreated";
 
     /**
      * @since 2.5
      */
-    @Parameter ( defaultValue = "false", property = 
"maven.compiler.skipMultiThreadWarning" )
+    @Parameter(defaultValue = "false", property = 
"maven.compiler.skipMultiThreadWarning")
     private boolean skipMultiThreadWarning;
 
     /**
@@ -331,13 +331,13 @@ public abstract class AbstractCompilerMo
      *
      * @since 3.0
      */
-    @Parameter ( defaultValue = "false", property = 
"maven.compiler.forceJavacCompilerUse" )
+    @Parameter(defaultValue = "false", property = 
"maven.compiler.forceJavacCompilerUse")
     private boolean forceJavacCompilerUse;
 
     /**
      * @since 3.0 needed for storing the status for the incremental build 
support.
      */
-    @Parameter ( property = "mojoExecution" )
+    @Parameter(property = "mojoExecution")
     private MojoExecution mojoExecution;
 
     /**
@@ -351,6 +351,7 @@ public abstract class AbstractCompilerMo
     /**
      * file extensions to check timestamp for incremental build
      * <b>default contains only <code>.class</code></b>
+     *
      * @since 3.1
      */
     @Parameter
@@ -817,6 +818,12 @@ public abstract class AbstractCompilerMo
         throws MojoExecutionException, CompilerException
     {
         String inputFileEnding = compiler.getInputFileEnding( 
compilerConfiguration );
+        if ( StringUtils.isEmpty( inputFileEnding ) )
+        {
+            // see MCOMPILER-199 GroovyEclipseCompiler doesn't set 
inputFileEnding
+            // so we can presume it's all files from the source directory
+            inputFileEnding = ".*";
+        }
         SourceInclusionScanner scanner = getSourceInclusionScanner( 
inputFileEnding );
 
         SourceMapping mapping = getSourceMapping( compilerConfiguration, 
compiler );
@@ -859,11 +866,11 @@ public abstract class AbstractCompilerMo
         Set<File> staleSources =
             computeStaleSources( compilerConfiguration, compiler, 
getSourceInclusionScanner( staleMillis ) );
 
-        if (getLog().isDebugEnabled())
+        if ( getLog().isDebugEnabled() )
         {
-            for (File f : staleSources)
+            for ( File f : staleSources )
             {
-                getLog().debug("Stale source detected: " + 
f.getAbsolutePath());
+                getLog().debug( "Stale source detected: " + 
f.getAbsolutePath() );
             }
         }
         return staleSources != null && staleSources.size() > 0;
@@ -920,8 +927,8 @@ public abstract class AbstractCompilerMo
         {
             value = setting + "m";
         }
-        else if ( ( isDigits( setting.substring( 0, setting.length() - 1 ) ) )
-            && ( setting.toLowerCase().endsWith( "m" ) ) )
+        else if ( ( isDigits( setting.substring( 0, setting.length() - 1 ) ) ) 
&& ( setting.toLowerCase().endsWith(
+            "m" ) ) )
         {
             value = setting;
         }
@@ -1075,7 +1082,7 @@ public abstract class AbstractCompilerMo
             {
                 if ( hasNewFile( artifactPath, buildStartTime ) )
                 {
-                    getLog().debug("New dependency detected: " + 
artifactPath.getAbsolutePath());
+                    getLog().debug( "New dependency detected: " + 
artifactPath.getAbsolutePath() );
                     return true;
                 }
             }
@@ -1086,7 +1093,6 @@ public abstract class AbstractCompilerMo
     }
 
     /**
-     *
      * @param classPathEntry entry to check
      * @param buildStartTime time build start
      * @return if any changes occured
@@ -1100,8 +1106,8 @@ public abstract class AbstractCompilerMo
 
         if ( classPathEntry.isFile() )
         {
-            return classPathEntry.lastModified() >= buildStartTime.getTime()
-                && fileExtensions.contains( FileUtils.getExtension( 
classPathEntry.getName() ) );
+            return classPathEntry.lastModified() >= buildStartTime.getTime() 
&& fileExtensions.contains(
+                FileUtils.getExtension( classPathEntry.getName() ) );
         }
 
         File[] children = classPathEntry.listFiles();


Reply via email to