diff --git a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 724a074..462a9d2 100644
--- a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -189,6 +189,18 @@
     @Parameter( defaultValue = "${basedir}/dependency-reduced-pom.xml" )
     protected File dependencyReducedPomLocation;
 
+    /**
+     * Directory where the SCR files will be written
+     */
+    @Parameter(defaultValue="${project.build.outputDirectory}")
+    protected File scrLocation;
+
+    /**
+     * When true, dump the generated SCR files
+     */
+    @Parameter
+    protected boolean exportScr;
+    
     @Component
     private MavenProjectHelper m_projectHelper;
 
@@ -507,7 +519,7 @@
 
                 try
                 {
-                    ManifestPlugin.writeManifest( builder, outputFile, niceManifest );
+                    ManifestPlugin.writeManifest( builder, outputFile, niceManifest, exportScr, scrLocation );
                 }
                 catch ( IOException e )
                 {
diff --git a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
index 1e1d025..ff33521 100644
--- a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
+++ b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
@@ -66,19 +66,6 @@
     @Parameter( property = "rebuildBundle" )
     protected boolean rebuildBundle;
 
-    /**
-     * Directory where the SCR files will be written
-     *
-     * @parameter expression="${scrLocation}" default-value="${project.build.outputDirectory}"
-     */
-    protected File scrLocation;
-
-    /**
-     * When true, dump the generated SCR files
-     * @parameter
-     */
-    protected boolean exportScr;
-
     @Override
     protected void execute( MavenProject project, DependencyNode dependencyGraph, Map<String, String> instructions, Properties properties, Jar[] classpath )
         throws MojoExecutionException
@@ -112,7 +99,7 @@
 
         try
         {
-            writeManifest( analyzer, outputFile, niceManifest );
+            writeManifest( analyzer, outputFile, niceManifest, exportScr, scrLocation );
         }
         catch ( Exception e )
         {
@@ -149,32 +136,7 @@
 
         if (exportScr)
         {
-            scrLocation.mkdirs();
-
-            String bpHeader = analyzer.getProperty(Analyzer.SERVICE_COMPONENT);
-            Parameters map = Processor.parseHeader(bpHeader, null);
-            for (String root : map.keySet())
-            {
-                Map<String, Resource> dir = jar.getDirectories().get(root);
-                File location = new File(scrLocation, root);
-                if (dir == null || dir.isEmpty())
-                {
-                    Resource resource = jar.getResource(root);
-                    if (resource != null)
-                    {
-                        writeSCR(resource, location);
-                    }
-                }
-                else
-                {
-                    for (Map.Entry<String, Resource> entry : dir.entrySet())
-                    {
-                        String path = entry.getKey();
-                        Resource resource = entry.getValue();
-                        writeSCR(resource, new File(location, path));
-                    }
-                }
-            }
+            exportScr(analyzer, jar, scrLocation);
         }
 
         // cleanup...
@@ -182,8 +144,37 @@
 
         return manifest;
     }
+    
+    private static void exportScr(Analyzer analyzer, Jar jar, File scrLocation) throws Exception {
+        scrLocation.mkdirs();
 
-    protected void writeSCR(Resource resource, File destination) throws Exception
+        String bpHeader = analyzer.getProperty(Analyzer.SERVICE_COMPONENT);
+        Parameters map = Processor.parseHeader(bpHeader, null);
+        for (String root : map.keySet())
+        {
+            Map<String, Resource> dir = jar.getDirectories().get(root);
+            File location = new File(scrLocation, root);
+            if (dir == null || dir.isEmpty())
+            {
+                Resource resource = jar.getResource(root);
+                if (resource != null)
+                {
+                    writeSCR(resource, location);
+                }
+            }
+            else
+            {
+                for (Map.Entry<String, Resource> entry : dir.entrySet())
+                {
+                    String path = entry.getKey();
+                    Resource resource = entry.getValue();
+                    writeSCR(resource, new File(location, path));
+                }
+            }
+        }
+    }
+
+    private static void writeSCR(Resource resource, File destination) throws Exception
     {
         destination.getParentFile().mkdirs();
         OutputStream os = new FileOutputStream(destination);
@@ -295,10 +286,12 @@
     }
 
 
-    public static void writeManifest( Analyzer analyzer, File outputFile, boolean niceManifest ) throws Exception
+    public static void writeManifest( Analyzer analyzer, File outputFile, boolean niceManifest,
+            boolean exportScr, File scrLocation ) throws Exception
     {
         Properties properties = analyzer.getProperties();
-        Manifest manifest = analyzer.getJar().getManifest();
+        Jar jar = analyzer.getJar();
+        Manifest manifest = jar.getManifest();
         if ( outputFile.exists() && properties.containsKey( "Merge-Headers" ) )
         {
             Manifest analyzerManifest = manifest;
@@ -321,6 +314,11 @@
             parentFile.mkdirs();
         }
         writeManifest( manifest, outputFile, niceManifest );
+        
+        if (exportScr)
+        {
+            exportScr(analyzer, jar, scrLocation);            
+        }
     }
 
 
