You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2015/09/26 00:06:40 UTC

svn commit: r1705363 - in /aries/trunk/blueprint/blueprint-maven-plugin: ./ src/main/java/org/apache/aries/blueprint/plugin/ src/main/resources/ src/main/resources/META-INF/ src/main/resources/META-INF/m2e/

Author: cschneider
Date: Fri Sep 25 22:06:40 2015
New Revision: 1705363

URL: http://svn.apache.org/viewvc?rev=1705363&view=rev
Log:
[ARIES-1422] Support m2e incremental build in blueprint-maven-plugin

Added:
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/resources/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/m2e/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
Modified:
    aries/trunk/blueprint/blueprint-maven-plugin/pom.xml
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java

Modified: aries/trunk/blueprint/blueprint-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/pom.xml?rev=1705363&r1=1705362&r2=1705363&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-maven-plugin/pom.xml Fri Sep 25 22:06:40 2015
@@ -173,6 +173,11 @@
             <version>1.0-beta-4</version>
         </dependency>
         <dependency>
+            <groupId>org.sonatype.plexus</groupId>
+            <artifactId>plexus-build-api</artifactId>
+            <version>0.0.7</version>
+        </dependency>
+        <dependency>
             <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-utils</artifactId>
             <version>3.0</version>

Modified: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java?rev=1705363&r1=1705362&r2=1705363&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java (original)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java Fri Sep 25 22:06:40 2015
@@ -19,7 +19,7 @@
 package org.apache.aries.blueprint.plugin;
 
 import java.io.File;
-import java.io.FileOutputStream;
+import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -35,6 +35,7 @@ import org.apache.maven.plugin.MojoExecu
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
 import org.apache.xbean.finder.ClassFinder;
+import org.sonatype.plexus.build.incremental.BuildContext;
 
 /**
  * Generates blueprint from spring annotations
@@ -66,8 +67,17 @@ public class GenerateMojo extends Abstra
      * @parameter 
      */
     protected Set<String> namespaces;
+    
+    /**
+     * @component
+     */
+    private BuildContext buildContext;
 
     public void execute() throws MojoExecutionException, MojoFailureException {
+        if (!buildContext.hasDelta(new File(project.getCompileSourceRoots().iterator().next()))) {
+            return;
+        }
+        
         try {
             String buildDir = project.getBuild().getDirectory();
             String generatedDir = buildDir + "/generated-resources";
@@ -82,7 +92,9 @@ public class GenerateMojo extends Abstra
             Set<Class<?>> classes = FilteredClassFinder.findClasses(finder, scanPaths);
             Context context = new Context(classes);
             context.resolve();
-            new Generator(context, new FileOutputStream(file), namespaces).generate();
+            OutputStream fos = buildContext.newFileOutputStream(file);
+            new Generator(context, fos, namespaces).generate();
+            fos.close();
         } catch (Exception e) {
             throw new MojoExecutionException("Error building commands help", e);
         }

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml?rev=1705363&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml Fri Sep 25 22:06:40 2015
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<lifecycleMappingMetadata>
+    <pluginExecutions>
+        <pluginExecution>
+            <pluginExecutionFilter>
+                <goals>
+                    <goal>blueprint-generate</goal>
+                </goals>
+            </pluginExecutionFilter>
+            <action>
+                <execute>
+                    <runOnIncremental>true</runOnIncremental>
+                </execute>
+            </action>
+        </pluginExecution>
+    </pluginExecutions>
+</lifecycleMappingMetadata>
\ No newline at end of file