Commit the patch for the FELIX-398 issue. 
Adapt a little the patch to propagate the ignoreAnnotation flag to the manipulator.
Update the Ant task to support the ignoreAnnotation attribute.
Now, iPOJO Core and Arch set this flag to true to improve compilation time.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@586370 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/ant/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java b/ipojo/ant/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java
index 1aec42d..242b44a 100644
--- a/ipojo/ant/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java
+++ b/ipojo/ant/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java
@@ -45,6 +45,11 @@
      * Output bundle.

      */

     private File m_output;

+

+    /**

+     * Flag describing if we need to ignore annotation of not.

+     */

+    private boolean m_ignoreAnnotations = false;

     

     /**

      * Set the metadata file.

@@ -71,6 +76,14 @@
     }

     

     /**

+     * Set if we need to ignore annotations or not.

+     * @param flag : true if we need to ignore annotations.

+     */

+    public void setIgnoreAnnotations(boolean flag) {

+        m_ignoreAnnotations = flag;

+    }

+    

+    /**

      * Execute the Ant Task.

      * @see org.apache.tools.ant.Task#execute()

      */

@@ -89,8 +102,14 @@
         if (m_metadata == null) {

             m_metadata = new File("./metadata.xml");

             if (!m_metadata.exists()) {

-                System.out.println("No metadata file found - try to use only annotations");

-                m_metadata = null;

+             // Verify if annotations are ignored

+                if (m_ignoreAnnotations) {

+                    System.out.println("No metadata file found - ignore annotations");

+                    return;

+                } else {

+                    System.out.println("No metadata file found - try to use only annotations");

+                    m_metadata = null;

+                }

             } else {

                 System.out.println("Metadata File : " + m_metadata.getAbsolutePath());

             }

@@ -115,6 +134,9 @@
         }

         

         Pojoization pojo = new Pojoization();

+        if (! m_ignoreAnnotations) {

+            pojo.setAnnotationProcessing();

+        }

         pojo.pojoization(m_input, m_output, m_metadata);

         for (int i = 0; i < pojo.getWarnings().size(); i++) {

             System.out.println((String) pojo.getWarnings().get(i));

diff --git a/ipojo/arch/pom.xml b/ipojo/arch/pom.xml
index 4c3e130..b113c3c 100644
--- a/ipojo/arch/pom.xml
+++ b/ipojo/arch/pom.xml
@@ -51,7 +51,7 @@
 	              <goal>ipojo-bundle</goal>
                </goals>
             <configuration>
-   				<metadata>metadata.xml</metadata>
+   				<ignoreAnnotations>true</ignoreAnnotations>
             </configuration>
           </execution>
         </executions>
diff --git a/ipojo/core/pom.xml b/ipojo/core/pom.xml
index a585389..0a89712 100644
--- a/ipojo/core/pom.xml
+++ b/ipojo/core/pom.xml
@@ -90,6 +90,7 @@
                </goals>
             <configuration>
    				<metadata>metadata.xml</metadata>
+   				<ignoreAnnotations>true</ignoreAnnotations>
             </configuration>
           </execution>
         </executions>
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
index 18b025a..b78666f 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
@@ -86,6 +86,11 @@
     private List m_referredPackages;

 

     /**

+     * Flag describing if we need of not compute annotations.

+     */

+    private boolean m_ignoreAnnotations;

+

+    /**

      * Add an error in the error list.

      * @param mes : error message.

      */

@@ -104,6 +109,13 @@
     public List getErrors() {

         return m_errors;

     }

+    

+    /**

+     * Activate annotation processing.

+     */

+    public void setAnnotationProcessing() {

+        m_ignoreAnnotations = false;

+    }

 

     /**

      * Manipulate a normal bundle.

@@ -283,7 +295,9 @@
                         in = in2;

                     }

                     currIn.close();

-                    computeAnnotations(in);

+                    if (! m_ignoreAnnotations) {

+                        computeAnnotations(in);

+                    }

                     // Check if we need to manipulate the class

                     for (int i = 0; i < m_components.size(); i++) {

                         ComponentInfo ci = (ComponentInfo) m_components.get(i);

diff --git a/ipojo/plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java b/ipojo/plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java
index 1f69a5e..1efcd2f 100644
--- a/ipojo/plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java
+++ b/ipojo/plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java
@@ -19,11 +19,14 @@
 package org.apache.felix.ipojo.plugin;

 

 import java.io.File;

+import java.util.Arrays;

+import java.util.List;

 

 import org.apache.felix.ipojo.manipulator.Pojoization;

 import org.apache.maven.plugin.AbstractMojo;

 import org.apache.maven.plugin.MojoExecutionException;

 import org.apache.maven.plugin.MojoFailureException;

+import org.apache.maven.project.MavenProject;

 

 /**

  * Package an OSGi jar "bundle" as an "iPOJO bundle".

@@ -64,24 +67,61 @@
     

     /**

      * Metadata file location.

-     * @parameter expression="${metadata}" default-value="metadata.xml"

+     * @parameter alias="metadata" default-value="metadata.xml"

      */

     private String m_metadata;

 

     /**

+     * The Maven project.

+     *

+     * @parameter expression="${project}"

+     * @required

+     * @readonly

+     */

+    private MavenProject m_project;

+

+    /**

+     * Project types which this plugin supports.

+     * @parameter

+     */

+    private List m_supportedProjectTypes = Arrays.asList(new String[]{"bundle"});

+

+    /**

+     * Ignore annotations parameter.

+     * @parameter alias="ignoreAnnotations" default-value="false"

+     */

+    private boolean m_ignoreAnnotations;

+

+    protected MavenProject getProject() {

+        return this.m_project;

+    }

+

+    /**

      * Execute method : launch the pojoization.

      * @throws MojoExecutionException : an exception occurs.

      * @throws MojoFailureException : an failure occurs.

      * @see org.apache.maven.plugin.AbstractMojo#execute()

      */

     public void execute() throws MojoExecutionException, MojoFailureException {

+        // ignore project types not supported, useful when the plugin is configured in the parent pom

+        if (!this.m_supportedProjectTypes.contains(this.getProject().getArtifact().getType())) {

+            this.getLog().debug("Ignoring project " + this.getProject().getArtifact() + " : type " + this.getProject().getArtifact().getType() + " is not supported by ipojo plugin, supported types are " + this.m_supportedProjectTypes);

+            return;

+        }

+

         getLog().info("Start bundle manipulation");

         // Get metadata file

         File meta = new File(m_outputDirectory + "/" + m_metadata);

         getLog().info("Metadata File : " + meta.getAbsolutePath());

         if (!meta.exists()) {

-            getLog().info("No metadata file found - try to use only annotations");

-            meta = null;

+            // Verify if annotations are ignored

+            if (m_ignoreAnnotations) {

+                getLog().info("No metadata file found - ignore annotations");

+                return;

+            } else {

+                getLog().info("No metadata file found - try to use only annotations");

+                meta = null;

+            }

         }

 

         // Get input bundle

@@ -94,6 +134,7 @@
         File out = new File(m_buildDirectory + "/_out.jar");

         

         Pojoization pojo = new Pojoization();

+        if (!m_ignoreAnnotations) { pojo.setAnnotationProcessing(); }

         pojo.pojoization(in, out, meta);

         for (int i = 0; i < pojo.getWarnings().size(); i++) {

             getLog().warn((String) pojo.getWarnings().get(i));