Add m2e lifecyle stuff


git-svn-id: https://svn.apache.org/repos/asf/cxf/build-utils/trunk@1405983 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/buildtools/pom.xml b/buildtools/pom.xml
index 48157a6..1447a50 100644
--- a/buildtools/pom.xml
+++ b/buildtools/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.apache.cxf.build-utils</groupId>
         <artifactId>cxf-build-utils</artifactId>
-        <version>2.4.2-SNAPSHOT</version>
+        <version>2.5.0-SNAPSHOT</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
@@ -68,14 +68,14 @@
         <dependency>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-shade-plugin</artifactId>
-            <version>1.3.2</version>
+            <version>2.0</version>
             <optional>true</optional>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>pmd</groupId>
             <artifactId>pmd</artifactId>
-            <version>4.2</version>
+            <version>4.3</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>
diff --git a/pom.xml b/pom.xml
index 0bec8c4..de9173c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.cxf.build-utils</groupId>
     <artifactId>cxf-build-utils</artifactId>
-    <version>2.4.2-SNAPSHOT</version>
+    <version>2.5.0-SNAPSHOT</version>
     <name>Apache CXF Build Utilities</name>
     <url>http://cxf.apache.org</url>
     <packaging>pom</packaging>
@@ -175,7 +175,7 @@
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-resources-plugin</artifactId>
-                     <version>2.3</version>
+                     <version>2.4</version>
                      <configuration>
                          <encoding>UTF-8</encoding>
                      </configuration>
diff --git a/xml2fastinfoset-plugin/pom.xml b/xml2fastinfoset-plugin/pom.xml
index 7e7dbd2..f47bc5a 100644
--- a/xml2fastinfoset-plugin/pom.xml
+++ b/xml2fastinfoset-plugin/pom.xml
@@ -21,12 +21,11 @@
     <parent>
          <groupId>org.apache.cxf.build-utils</groupId>
          <artifactId>cxf-build-utils</artifactId>
-         <version>2.4.2-SNAPSHOT</version>
+         <version>2.5.0-SNAPSHOT</version>
      </parent>
 
 
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.cxf.build-utils</groupId>
     <artifactId>cxf-xml2fastinfoset-plugin</artifactId>
     <packaging>maven-plugin</packaging>
     <name>Apache CXF XML to FastInfoset Maven2 Plugin</name>
@@ -50,7 +49,7 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.4</version>
+            <version>4.10</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -59,6 +58,13 @@
             <version>2.0.9</version>
             <scope>provided</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.sonatype.plexus</groupId>
+            <artifactId>plexus-build-api</artifactId>
+            <version>0.0.7</version>
+            <optional>true</optional>
+        </dependency>        
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-project</artifactId>
@@ -74,12 +80,12 @@
         <dependency>
             <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-utils</artifactId>
-            <version>1.0.4</version>
+            <version>2.0.5</version>
         </dependency>
         <dependency>
             <groupId>com.sun.xml.fastinfoset</groupId>
             <artifactId>FastInfoset</artifactId>
-            <version>1.2.7</version>
+            <version>1.2.12</version>
         </dependency>
     </dependencies>
 </project>
diff --git a/xml2fastinfoset-plugin/src/main/java/org/apache/cxf/maven_plugin/xml2fastinfoset/XML2FastInfosetCompilerMojo.java b/xml2fastinfoset-plugin/src/main/java/org/apache/cxf/maven_plugin/xml2fastinfoset/XML2FastInfosetCompilerMojo.java
index 1830ddd..4d36b70 100644
--- a/xml2fastinfoset-plugin/src/main/java/org/apache/cxf/maven_plugin/xml2fastinfoset/XML2FastInfosetCompilerMojo.java
+++ b/xml2fastinfoset-plugin/src/main/java/org/apache/cxf/maven_plugin/xml2fastinfoset/XML2FastInfosetCompilerMojo.java
@@ -35,6 +35,7 @@
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.sonatype.plexus.build.incremental.BuildContext;
 import org.xml.sax.SAXException;
 
 import com.sun.xml.fastinfoset.sax.SAXDocumentSerializer;
@@ -44,6 +45,7 @@
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.Scanner;
 
 /**
  * Compile XML resources to FastInfoset XML resources.
@@ -93,6 +95,10 @@
      * @required
      */
     private File outputDirectory;
+    
+    /** @component */
+    protected BuildContext buildContext;
+        
 
     @SuppressWarnings("unchecked")
     public void execute() throws MojoExecutionException {
@@ -111,10 +117,8 @@
                 continue;
             }
 
+            Scanner scanner = buildContext.newScanner(resourceDirectory);
 
-            DirectoryScanner scanner = new DirectoryScanner();
-
-            scanner.setBasedir(resourceDirectory);
             if (includes != null && !includes.isEmpty()) {
                 scanner.setIncludes((String[])includes.toArray(EMPTY_STRING_ARRAY));
             } else {
@@ -166,6 +170,7 @@
                 } catch (Exception e) {
                     throw new MojoExecutionException("Error copying resource " + source, e);
                 }
+                buildContext.refresh(destinationFile);
             }
 
         }
diff --git a/xml2fastinfoset-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml b/xml2fastinfoset-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
new file mode 100644
index 0000000..17b1083
--- /dev/null
+++ b/xml2fastinfoset-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
@@ -0,0 +1,17 @@
+<lifecycleMappingMetadata>
+  <pluginExecutions>
+    <pluginExecution>
+      <pluginExecutionFilter>
+        <goals>
+          <goal>xml2fastinfoset</goal>
+        </goals>
+      </pluginExecutionFilter>
+      <action>
+        <execute>
+          <runOnIncremental>true</runOnIncremental>
+          <runOnConfiguration>true</runOnConfiguration>
+        </execute>
+      </action>
+    </pluginExecution>
+</lifecycleMappingMetadata>
+
diff --git a/xml2fastinfoset-test/pom.xml b/xml2fastinfoset-test/pom.xml
index eca7e84..dac0f8d 100644
--- a/xml2fastinfoset-test/pom.xml
+++ b/xml2fastinfoset-test/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.cxf.build-utils</groupId>
         <artifactId>cxf-build-utils</artifactId>
-        <version>2.4.2-SNAPSHOT</version>
+        <version>2.5.0-SNAPSHOT</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
@@ -37,7 +37,7 @@
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
-            <version>4.4</version>
+            <version>4.11-beta-1</version>
         </dependency>
     </dependencies>
     <build>
@@ -57,4 +57,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>