Author: dkulp
Date: Thu Nov  1 15:14:54 2012
New Revision: 1404630

URL: http://svn.apache.org/viewvc?rev=1404630&view=rev
Log:
Merged revisions 1404619 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1404619 | dkulp | 2012-11-01 10:52:09 -0400 (Thu, 01 Nov 2012) | 3 lines

  [CXF-4581] UPdates to work better with m2eclipse incremental builds
  Patch from Josh Beitelspacher applied.

........

Modified:
    
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java

Modified: 
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java?rev=1404630&r1=1404629&r2=1404630&view=diff
==============================================================================
--- 
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
 (original)
+++ 
cxf/branches/2.6.x-fixes/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
 Thu Nov  1 15:14:54 2012
@@ -220,6 +220,20 @@ public abstract class AbstractCodegenMoh
     }
 
     public void execute() throws MojoExecutionException {
+        // add the generated source into compile source
+        // do this step first to ensure the source folder will be added to the 
Eclipse classpath
+        if (project != null && getGeneratedSourceRoot() != null) {
+            
project.addCompileSourceRoot(getGeneratedSourceRoot().getAbsolutePath());
+        }
+        if (project != null && getGeneratedTestRoot() != null) {
+            
project.addTestCompileSourceRoot(getGeneratedTestRoot().getAbsolutePath());
+        }
+
+        // if this is an m2e configuration build then return immediately 
without doing any work
+        if (project != null && buildContext.isIncremental() && 
!buildContext.hasDelta(project.getBasedir())) {
+            return;
+        }
+
         File classesDir = new File(classesDirectory);
         /*
          * This shouldn't be needed, but it's harmless.
@@ -272,13 +286,11 @@ public abstract class AbstractCodegenMoh
             classLoaderSwitcher.restoreClassLoader();
         }
 
-        // add the generated source into compile source
+        // refresh the generated sources
         if (project != null && getGeneratedSourceRoot() != null && 
getGeneratedSourceRoot().exists()) {
-            
project.addCompileSourceRoot(getGeneratedSourceRoot().getAbsolutePath());
             buildContext.refresh(getGeneratedSourceRoot().getAbsoluteFile());
         }
         if (project != null && getGeneratedTestRoot() != null && 
getGeneratedTestRoot().exists()) {
-            
project.addTestCompileSourceRoot(getGeneratedTestRoot().getAbsolutePath());
             buildContext.refresh(getGeneratedTestRoot().getAbsoluteFile());
         }
         System.gc();


Reply via email to