diff --git a/scrplugin/maven-scr-plugin/NOTICE b/scrplugin/maven-scr-plugin/NOTICE
index 35bf375..1f049c9 100644
--- a/scrplugin/maven-scr-plugin/NOTICE
+++ b/scrplugin/maven-scr-plugin/NOTICE
@@ -1,5 +1,5 @@
 Apache Felix SCR Maven Plugin
-Copyright 2007-2011 The Apache Software Foundation
+Copyright 2007-2012 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
diff --git a/scrplugin/maven-scr-plugin/pom.xml b/scrplugin/maven-scr-plugin/pom.xml
index 5ba3f38..446a33e 100644
--- a/scrplugin/maven-scr-plugin/pom.xml
+++ b/scrplugin/maven-scr-plugin/pom.xml
@@ -29,7 +29,7 @@
     <groupId>org.apache.felix</groupId>
     <artifactId>maven-scr-plugin</artifactId>
 
-    <version>1.7.5-SNAPSHOT</version>
+    <version>1.8.0-SNAPSHOT</version>
     <packaging>maven-plugin</packaging>
 
     <name>Maven SCR Plugin</name>
@@ -57,9 +57,20 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.scr.generator</artifactId>
-            <version>1.1.5-SNAPSHOT</version>
+            <version>1.2.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <version>1.7.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>asm</groupId>
+            <artifactId>asm-all</artifactId>
+            <version>3.3.1</version>
+        </dependency>
     </dependencies>
     
     <build>
diff --git a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenLog.java b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenLog.java
index d5d9697..417509f 100644
--- a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenLog.java
+++ b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenLog.java
@@ -18,144 +18,154 @@
  */
 package org.apache.felix.scrplugin.mojo;
 
-
 import org.apache.felix.scrplugin.Log;
 
-
 /**
  * The <code>MavenLog</code> class implements the {@link Log} interface using
  * the Maven logger created on instantiation.
  */
-public class MavenLog implements Log
-{
+public class MavenLog implements Log {
 
     private final org.apache.maven.plugin.logging.Log mavenLog;
 
-
-    MavenLog( org.apache.maven.plugin.logging.Log mavenLog )
-    {
+    MavenLog(final org.apache.maven.plugin.logging.Log mavenLog) {
         this.mavenLog = mavenLog;
     }
 
-
-    public void debug( String content, Throwable error )
-    {
-        mavenLog.debug( content, error );
+    /**
+     * @see org.apache.felix.scrplugin.Log#debug(java.lang.String,
+     *      java.lang.Throwable)
+     */
+    public void debug(final String content, final Throwable error) {
+        mavenLog.debug(content, error);
     }
 
-
-    public void debug( String content )
-    {
-        mavenLog.debug( content );
+    /**
+     * @see org.apache.felix.scrplugin.Log#debug(java.lang.String)
+     */
+    public void debug(final String content) {
+        mavenLog.debug(content);
     }
 
-
-    public void debug( Throwable error )
-    {
-        mavenLog.debug( error );
+    /**
+     * @see org.apache.felix.scrplugin.Log#debug(java.lang.Throwable)
+     */
+    public void debug(final Throwable error) {
+        mavenLog.debug(error);
     }
 
-
-    public void error( String content, Throwable error )
-    {
-        mavenLog.error( content, error );
+    /**
+     * @see org.apache.felix.scrplugin.Log#error(java.lang.String, java.lang.Throwable)
+     */
+    public void error(final String content, final Throwable error) {
+        mavenLog.error(content, error);
     }
 
-
-    public void error( String content, String location, int lineNumber )
-    {
-        if ( isErrorEnabled() )
-        {
-            final String message = formatMessage( content, location, lineNumber );
-            mavenLog.error( message );
-        }
+    /**
+     * @see org.apache.felix.scrplugin.Log#error(java.lang.String, java.lang.String, int)
+     */
+    public void error(final String content,
+            final String location,
+            final int lineNumber) {
+        final String message = formatMessage(content, location, lineNumber);
+        mavenLog.error(message);
     }
 
-
-    public void error( String content )
-    {
-        mavenLog.error( content );
+    /**
+     * @see org.apache.felix.scrplugin.Log#error(java.lang.String)
+     */
+    public void error(final String content) {
+        mavenLog.error(content);
     }
 
-
-    public void error( Throwable error )
-    {
-        mavenLog.error( error );
+    /**
+     * @see org.apache.felix.scrplugin.Log#error(java.lang.Throwable)
+     */
+    public void error(final Throwable error) {
+        mavenLog.error(error);
     }
 
-
-    public void info( String content, Throwable error )
-    {
-        mavenLog.info( content, error );
+    /**
+     * @see org.apache.felix.scrplugin.Log#info(java.lang.String, java.lang.Throwable)
+     */
+    public void info(final String content, final Throwable error) {
+        mavenLog.info(content, error);
     }
 
-
-    public void info( String content )
-    {
-        mavenLog.info( content );
+    /**
+     * @see org.apache.felix.scrplugin.Log#info(java.lang.String)
+     */
+    public void info(final String content) {
+        mavenLog.info(content);
     }
 
-
-    public void info( Throwable error )
-    {
-        mavenLog.info( error );
+    /**
+     * @see org.apache.felix.scrplugin.Log#info(java.lang.Throwable)
+     */
+    public void info(final Throwable error) {
+        mavenLog.info(error);
     }
 
-
-    public boolean isDebugEnabled()
-    {
+    /**
+     * @see org.apache.felix.scrplugin.Log#isDebugEnabled()
+     */
+    public boolean isDebugEnabled() {
         return mavenLog.isDebugEnabled();
     }
 
-
-    public boolean isErrorEnabled()
-    {
+    /**
+     * @see org.apache.felix.scrplugin.Log#isErrorEnabled()
+     */
+    public boolean isErrorEnabled() {
         return mavenLog.isErrorEnabled();
     }
 
-
-    public boolean isInfoEnabled()
-    {
+    /**
+     * @see org.apache.felix.scrplugin.Log#isInfoEnabled()
+     */
+    public boolean isInfoEnabled() {
         return mavenLog.isInfoEnabled();
     }
 
-
-    public boolean isWarnEnabled()
-    {
+    /**
+     * @see org.apache.felix.scrplugin.Log#isWarnEnabled()
+     */
+    public boolean isWarnEnabled() {
         return mavenLog.isWarnEnabled();
     }
 
-
-    public void warn( String content, Throwable error )
-    {
-        mavenLog.warn( content, error );
+    /**
+     * @see org.apache.felix.scrplugin.Log#warn(java.lang.String, java.lang.Throwable)
+     */
+    public void warn(final String content, final Throwable error) {
+        mavenLog.warn(content, error);
     }
 
-
-    public void warn( String content, String location, int lineNumber )
-    {
-        if ( isWarnEnabled() )
-        {
-            final String message = formatMessage( content, location, lineNumber );
-            mavenLog.warn( message );
-        }
+    /**
+     * @see org.apache.felix.scrplugin.Log#warn(java.lang.String, java.lang.String, int)
+     */
+    public void warn(final String content, final String location,
+            final int lineNumber) {
+        final String message = formatMessage(content, location, lineNumber);
+        mavenLog.warn(message);
     }
 
-
-    public void warn( String content )
-    {
-        mavenLog.warn( content );
+    /**
+     * @see org.apache.felix.scrplugin.Log#warn(java.lang.String)
+     */
+    public void warn(final String content) {
+        mavenLog.warn(content);
     }
 
-
-    public void warn( Throwable error )
-    {
-        mavenLog.warn( error );
+    /**
+     * @see org.apache.felix.scrplugin.Log#warn(java.lang.Throwable)
+     */
+    public void warn(final Throwable error) {
+        mavenLog.warn(error);
     }
 
-
-    private String formatMessage( String content, String location, int lineNumber )
-    {
+    private String formatMessage(final String content, final String location,
+            final int lineNumber) {
         return content + " at " + location + ":" + lineNumber;
     }
 }
diff --git a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenProjectScanner.java
similarity index 63%
rename from scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java
rename to scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenProjectScanner.java
index 870ee04..3d8b1f6 100644
--- a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java
+++ b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenProjectScanner.java
@@ -20,17 +20,20 @@
 
 
 import java.io.File;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
 
-import org.apache.felix.scrplugin.*;
+import org.apache.felix.scrplugin.Log;
 import org.apache.felix.scrplugin.helper.StringUtils;
+import org.apache.felix.scrplugin.scanner.Source;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.DirectoryScanner;
 
 
-public class MavenJavaClassDescriptorManager extends JavaClassDescriptorManager
-{
+public class MavenProjectScanner {
 
     private final MavenProject project;
 
@@ -38,28 +41,23 @@
 
     private final String excludeString;
 
-    public MavenJavaClassDescriptorManager( MavenProject project, Log log, ClassLoader classLoader,
-        String[] annotationTagProviders, String includeString, String excludeString, boolean parseJavadocs, boolean processAnnotations )
-        throws SCRDescriptorFailureException
-    {
-        super( log, classLoader, annotationTagProviders, parseJavadocs, processAnnotations );
+    private final Log log;
 
+    public MavenProjectScanner( final MavenProject project,
+            final String includeString,
+            final String excludeString,
+            final Log log) {
         this.project = project;
         this.includeString = includeString;
         this.excludeString = excludeString;
+        this.log = log;
     }
 
-
-    public String getOutputDirectory()
-    {
-        return this.project.getBuild().getOutputDirectory();
-    }
-
-
-    @Override
-    protected Iterator<File> getSourceFiles()
-    {
-        ArrayList<File> files = new ArrayList<File>();
+    /**
+     * Return all sources.
+     */
+    public Collection<Source> getSources() {
+        final ArrayList<Source> files = new ArrayList<Source>();
 
         @SuppressWarnings("unchecked")
         final Iterator<String> i = project.getCompileSourceRoots().iterator();
@@ -71,30 +69,24 @@
         }
 
         final String[] excludes;
-        if ( excludeString != null )
-        {
+        if ( excludeString != null ) {
             excludes = StringUtils.split( excludeString, "," );
-        }
-        else
-        {
+        } else {
             excludes = null;
         }
 
-        while ( i.hasNext() )
-        {
+        while ( i.hasNext() ) {
             final String tree = i.next();
             final File directory = new File( tree );
-            if ( !directory.exists() )
-            {
-                this.log.warn("Source tree does not exist. Ignoring " + tree);
+            if ( !directory.exists() ) {
+                log.warn("Source tree does not exist. Ignoring " + tree);
                 continue;
             }
-            this.log.debug( "Scanning source tree " + tree );
+            log.debug( "Scanning source tree " + tree );
             final DirectoryScanner scanner = new DirectoryScanner();
             scanner.setBasedir( directory );
 
-            if ( excludes != null && excludes.length > 0 )
-            {
+            if ( excludes != null && excludes.length > 0 ) {
                 scanner.setExcludes( excludes );
             }
             scanner.addDefaultExcludes();
@@ -102,53 +94,52 @@
 
             scanner.scan();
 
-            for ( String fileName : scanner.getIncludedFiles() )
-            {
-                files.add( new File( directory, fileName ) );
+            for ( final String fileName : scanner.getIncludedFiles() ) {
+                files.add( new Source() {
 
+                    public File getFile() {
+                        return new File(directory, fileName);
+                    }
+
+                    public String getClassName() {
+                        // remove ".java"
+                        String name = fileName.substring(0, fileName.length() - 5);
+                        return name.replace(File.separatorChar, '/').replace('/', '.');
+                    }
+                });
             }
         }
 
-        return files.iterator();
+        return files;
     }
 
-
-    @Override
-    protected List<File> getDependencies()
-    {
-        ArrayList<File> dependencies = new ArrayList<File>();
+    /**
+     * Return all dependencies
+     */
+    public List<File> getDependencies() {
+        final ArrayList<File> dependencies = new ArrayList<File>();
 
         @SuppressWarnings("unchecked")
         final Iterator<Artifact> it = project.getArtifacts().iterator();
-        while ( it.hasNext() )
-        {
+        while ( it.hasNext() ) {
             final Artifact declared = it.next();
             this.log.debug( "Checking artifact " + declared );
-            if ( this.isJavaArtifact( declared ) )
-            {
+            if ( this.isJavaArtifact( declared ) ) {
                 if ( Artifact.SCOPE_COMPILE.equals( declared.getScope() )
                     || Artifact.SCOPE_RUNTIME.equals( declared.getScope() )
                     || Artifact.SCOPE_PROVIDED.equals( declared.getScope() )
-                    || Artifact.SCOPE_SYSTEM.equals( declared.getScope() ) )
-                {
+                    || Artifact.SCOPE_SYSTEM.equals( declared.getScope() ) ) {
                     this.log.debug( "Resolving artifact " + declared );
-                    if ( declared.getFile() != null )
-                    {
+                    if ( declared.getFile() != null ) {
                         dependencies.add( declared.getFile() );
-                    }
-                    else
-                    {
+                    } else {
                         this.log.debug( "Unable to resolve artifact " + declared );
                     }
-                }
-                else
-                {
+                } else {
                     this.log.debug( "Artifact " + declared + " has not scope compile or runtime, but "
                         + declared.getScope() );
                 }
-            }
-            else
-            {
+            } else {
                 this.log.debug( "Artifact " + declared + " is not a java artifact, type is " + declared.getType() );
             }
         }
@@ -160,17 +151,13 @@
     /**
      * Check if the artifact is a java artifact (jar or bundle)
      */
-    private boolean isJavaArtifact( Artifact artifact )
-    {
-        if ( "jar".equals( artifact.getType() ) )
-        {
+    private boolean isJavaArtifact( Artifact artifact ) {
+        if ( "jar".equals( artifact.getType() ) ) {
             return true;
         }
-        if ( "bundle".equals( artifact.getType() ) )
-        {
+        if ( "bundle".equals( artifact.getType() ) ) {
             return true;
         }
         return false;
     }
-
 }
diff --git a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
index bc0a65c..c22f564 100644
--- a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
+++ b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
@@ -22,20 +22,34 @@
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
 
-import org.apache.felix.scrplugin.*;
+import org.apache.felix.scrplugin.Options;
+import org.apache.felix.scrplugin.Project;
+import org.apache.felix.scrplugin.Result;
+import org.apache.felix.scrplugin.SCRDescriptorException;
+import org.apache.felix.scrplugin.SCRDescriptorFailureException;
+import org.apache.felix.scrplugin.SCRDescriptorGenerator;
+import org.apache.felix.scrplugin.description.SpecVersion;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
 import org.apache.maven.model.Resource;
-import org.apache.maven.plugin.*;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.StringUtils;
 
 /**
- * The <code>SCRDescriptorMojo</code>
- * generates a service descriptor file based on annotations found in the sources.
+ * The <code>SCRDescriptorMojo</code> generates a service descriptor file based
+ * on annotations found in the sources.
  *
  * @goal scr
  * @phase process-classes
@@ -67,7 +81,8 @@
      *
      * @see #checkAnnotationArtifact(Artifact)
      */
-    private static final ArtifactVersion SCR_ANN_MIN_VERSION = new DefaultArtifactVersion("1.5.1");
+    private static final ArtifactVersion SCR_ANN_MIN_VERSION = new DefaultArtifactVersion(
+            "1.6.9");
 
     /**
      * @parameter expression="${project.build.directory}/scr-plugin-generated"
@@ -88,7 +103,8 @@
     /**
      * Name of the generated descriptor.
      *
-     * @parameter expression="${scr.descriptor.name}" default-value="serviceComponents.xml"
+     * @parameter expression="${scr.descriptor.name}"
+     *            default-value="serviceComponents.xml"
      */
     private String finalName;
 
@@ -101,38 +117,25 @@
 
     /**
      * This flag controls the generation of the bind/unbind methods.
+     *
      * @parameter default-value="true"
      */
     private boolean generateAccessors;
 
     /**
-     * This flag controls whether the javadoc source code will be scanned for
-     * tags.
-     * @parameter default-value="true"
-     */
-    protected boolean parseJavadoc;
-
-    /**
-     * This flag controls whether the annotations in the sources will be
-     * processed.
-     * @parameter default-value="true"
-     */
-    protected boolean processAnnotations;
-
-    /**
      * In strict mode the plugin even fails on warnings.
+     *
      * @parameter default-value="false"
      */
     protected boolean strictMode;
 
-    
     /**
      * The comma separated list of tokens to include when processing sources.
-     * 
+     *
      * @parameter alias="includes"
      */
     private String sourceIncludes;
-    
+
     /**
      * The comma separated list of tokens to exclude when processing sources.
      *
@@ -149,87 +152,97 @@
 
     /**
      * Allows to define additional implementations of the interface
-     * {@link org.apache.felix.scrplugin.tags.annotation.AnnotationTagProvider}
-     * that provide mappings from custom annotations to
-     * {@link org.apache.felix.scrplugin.tags.JavaTag} implementations.
-     * List of full qualified class file names.
+     * {@link org.apache.felix.scrplugin.AnnotationProcessor} that provide
+     * mappings from custom annotations to descriptions.
      *
      * @parameter
      */
-    private String[] annotationTagProviders = {};
+    private String[] annotationProcessors = {};
 
     /**
-     * The version of the DS spec this plugin generates a descriptor for.
-     * By default the version is detected by the used tags.
+     * The version of the DS spec this plugin generates a descriptor for. By
+     * default the version is detected by the used tags.
+     *
      * @parameter
      */
     private String specVersion;
 
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        // create the log for the generator
+        final org.apache.felix.scrplugin.Log scrLog = new MavenLog(getLog());
+        // create the class loader
+        final ClassLoader classLoader = new URLClassLoader(getClassPath(), this
+                .getClass().getClassLoader());
 
-    public void execute() throws MojoExecutionException, MojoFailureException
-    {
-        try
-        {
-            final org.apache.felix.scrplugin.Log scrLog = new MavenLog( getLog() );
+        // create project
+        final MavenProjectScanner scanner = new MavenProjectScanner(
+                this.project, this.sourceIncludes, this.sourceExcludes, scrLog);
 
-            final ClassLoader classLoader = new URLClassLoader( getClassPath(), this.getClass().getClassLoader() );
-            final JavaClassDescriptorManager jManager = new MavenJavaClassDescriptorManager( project, scrLog,
-                classLoader, this.annotationTagProviders, this.sourceIncludes, this.sourceExcludes, this.parseJavadoc,
-                this.processAnnotations );
+        final Project project = new Project();
+        project.setClassLoader(classLoader);
+        project.setDependencies(scanner.getDependencies());
+        project.setSources(scanner.getSources());
+        project.setClassesDirectory(this.project.getBuild().getOutputDirectory());
 
-            final SCRDescriptorGenerator generator = new SCRDescriptorGenerator( scrLog );
+        // create options
+        final Options options = new Options();
+        options.setGenerateAccessors(generateAccessors);
+        options.setStrictMode(strictMode);
+        options.setProperties(properties);
+        options.setSpecVersion(SpecVersion.fromName(specVersion));
+        if ( specVersion != null && options.getSpecVersion() == null ) {
+            throw new MojoExecutionException("Unknown spec version specified: " + specVersion);
+        }
+        options.setAnnotationProcessors(annotationProcessors);
+        try {
+
+            final SCRDescriptorGenerator generator = new SCRDescriptorGenerator(
+                    scrLog);
 
             // setup from plugin configuration
-            generator.setOutputDirectory( outputDirectory );
-            generator.setDescriptorManager( jManager );
-            generator.setFinalName( finalName );
-            generator.setMetaTypeName( metaTypeName );
-            generator.setGenerateAccessors( generateAccessors );
-            generator.setStrictMode( strictMode );
-            generator.setProperties( properties );
-            generator.setSpecVersion( specVersion );
+            generator.setOutputDirectory(outputDirectory);
+            generator.setOptions(options);
+            generator.setProject(project);
+            generator.setFinalName(finalName);
+            generator.setMetaTypeName(metaTypeName);
 
-            if ( generator.execute() )
-            {
-                setServiceComponentHeader();
-                addResources();
-            }
-        }
-        catch ( SCRDescriptorException sde )
-        {
-            throw new MojoExecutionException( sde.getMessage(), sde.getCause() );
-        }
-        catch ( SCRDescriptorFailureException sdfe )
-        {
-            throw ( MojoFailureException ) new MojoFailureException( sdfe.getMessage() ).initCause( sdfe );
+            final Result result = generator.execute();
+            this.setServiceComponentHeader(result.getScrFiles());
+            this.updateProjectResources();
+
+        } catch (final SCRDescriptorException sde) {
+            throw new MojoExecutionException(sde.getMessage(), sde.getCause());
+        } catch (SCRDescriptorFailureException sdfe) {
+            throw (MojoFailureException) new MojoFailureException(
+                    sdfe.getMessage()).initCause(sdfe);
         }
     }
 
-    private URL[] getClassPath() throws MojoFailureException{
+    private URL[] getClassPath() throws MojoFailureException {
         @SuppressWarnings("unchecked")
         List<Artifact> artifacts = this.project.getCompileArtifacts();
         ArrayList<URL> path = new ArrayList<URL>();
 
-        try
-        {
-            path.add(new File( this.project.getBuild().getOutputDirectory() ).toURI().toURL());
-        }
-        catch ( IOException ioe )
-        {
-            throw new MojoFailureException( "Unable to add target directory to classloader.");
+        try {
+            path.add(new File(this.project.getBuild().getOutputDirectory())
+                    .toURI().toURL());
+        } catch (final IOException ioe) {
+            throw new MojoFailureException(
+                    "Unable to add target directory to classloader.");
         }
 
-        for (Iterator<Artifact> ai=artifacts.iterator(); ai.hasNext(); ) {
+        for (Iterator<Artifact> ai = artifacts.iterator(); ai.hasNext();) {
             Artifact a = ai.next();
             assertMinScrAnnotationArtifactVersion(a);
             try {
                 path.add(a.getFile().toURI().toURL());
             } catch (IOException ioe) {
-                throw new MojoFailureException("Unable to get compile class loader.");
+                throw new MojoFailureException(
+                        "Unable to get compile class loader.");
             }
         }
 
-        return path.toArray( new URL[path.size()] );
+        return path.toArray(new URL[path.size()]);
     }
 
     /**
@@ -240,61 +253,83 @@
      * SCR Annotation libraries do not produce descriptors any more. If the
      * artifact is not this method silently returns.
      *
-     * @param a The artifact to check and assert
+     * @param a
+     *            The artifact to check and assert
      * @see #SCR_ANN_ARTIFACTID
      * @see #SCR_ANN_GROUPID
      * @see #SCR_ANN_MIN_VERSION
-     * @throws MojoFailureException If the artifact refers to the SCR Annotation
-     *             library with a version less than {@link #SCR_ANN_MIN_VERSION}
+     * @throws MojoFailureException
+     *             If the artifact refers to the SCR Annotation library with a
+     *             version less than {@link #SCR_ANN_MIN_VERSION}
      */
-    private void assertMinScrAnnotationArtifactVersion(Artifact a) throws MojoFailureException
-    {
-        if (SCR_ANN_ARTIFACTID.equals(a.getArtifactId()) && SCR_ANN_GROUPID.equals(a.getGroupId()))
-        {
+    @SuppressWarnings("unchecked")
+    private void assertMinScrAnnotationArtifactVersion(final Artifact a)
+            throws MojoFailureException {
+        if (SCR_ANN_ARTIFACTID.equals(a.getArtifactId())
+                && SCR_ANN_GROUPID.equals(a.getGroupId())) {
             // assert minimal version number
-            ArtifactVersion aVersion = new DefaultArtifactVersion(a.getBaseVersion());
-            if (SCR_ANN_MIN_VERSION.compareTo(aVersion) > 0)
-            {
+            final ArtifactVersion aVersion = new DefaultArtifactVersion(a.getBaseVersion());
+            if (SCR_ANN_MIN_VERSION.compareTo(aVersion) > 0) {
                 getLog().error("Project depends on " + a);
-                getLog().error("Minimum required version is " + SCR_ANN_MIN_VERSION);
-                throw new MojoFailureException("Please use org.apache.felix:org.apache.felix.scr.annotations version "
-                    + SCR_ANN_MIN_VERSION + " or newer.");
+                getLog().error(
+                        "Minimum required version is " + SCR_ANN_MIN_VERSION);
+                throw new MojoFailureException(
+                        "Please use org.apache.felix:org.apache.felix.scr.annotations version "
+                                + SCR_ANN_MIN_VERSION + " or newer.");
             }
         }
     }
 
-    private void setServiceComponentHeader()
-    {
-        final File descriptorFile = StringUtils.isEmpty( this.finalName ) ? null : new File( new File(
-            this.outputDirectory, "OSGI-INF" ), this.finalName );
-        if ( descriptorFile.exists() )
-        {
-            String svcComp = project.getProperties().getProperty( "Service-Component" );
-            final String svcPath = "OSGI-INF/" + finalName;
-            svcComp = ( svcComp == null ) ? svcPath :
-                svcComp.contains(svcPath) ? svcComp : svcComp + ", " + svcPath;
-            project.getProperties().setProperty( "Service-Component", svcComp );
+    /**
+     * Set the service component header based on the scr files.
+     */
+    private void setServiceComponentHeader(final List<String> files) {
+        if ( files != null && files.size() > 0 ) {
+            final String svcHeader = project.getProperties().getProperty("Service-Component");
+            final Set<String> xmlFiles = new HashSet<String>();
+            if ( svcHeader != null ) {
+                final StringTokenizer st = new StringTokenizer(svcHeader, ",");
+                while ( st.hasMoreTokens() ) {
+                    final String token = st.nextToken();
+                    xmlFiles.add(token.trim());
+                }
+            }
+
+            for(final String path : files) {
+                xmlFiles.add(path);
+            }
+            final StringBuilder sb = new StringBuilder();
+            boolean first = true;
+            for(final String entry : xmlFiles) {
+                if ( !first ) {
+                    sb.append(", ");
+                } else {
+                    first = false;
+                }
+                sb.append(entry);
+            }
+            project.getProperties().setProperty("Service-Component", sb.toString());
         }
     }
 
-
-    private void addResources()
-    {
+    /**
+     * Update the Maven project resources.
+     */
+    private void updateProjectResources() {
         // now add the descriptor directory to the maven resources
         final String ourRsrcPath = this.outputDirectory.getAbsolutePath();
         boolean found = false;
         @SuppressWarnings("unchecked")
-        final Iterator<Resource> rsrcIterator = this.project.getResources().iterator();
-        while ( !found && rsrcIterator.hasNext() )
-        {
+        final Iterator<Resource> rsrcIterator = this.project.getResources()
+                .iterator();
+        while (!found && rsrcIterator.hasNext()) {
             final Resource rsrc = rsrcIterator.next();
-            found = rsrc.getDirectory().equals( ourRsrcPath );
+            found = rsrc.getDirectory().equals(ourRsrcPath);
         }
-        if ( !found )
-        {
+        if (!found) {
             final Resource resource = new Resource();
-            resource.setDirectory( this.outputDirectory.getAbsolutePath() );
-            this.project.addResource( resource );
+            resource.setDirectory(this.outputDirectory.getAbsolutePath());
+            this.project.addResource(resource);
         }
     }
 }
