FELIX-1115: use version ranges + clean up a bit gshell-core

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@771352 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/assembly/src/main/filtered-resources/etc/config.properties b/karaf/assembly/src/main/filtered-resources/etc/config.properties
index b8b1457..dbe5629 100644
--- a/karaf/assembly/src/main/filtered-resources/etc/config.properties
+++ b/karaf/assembly/src/main/filtered-resources/etc/config.properties
@@ -25,10 +25,10 @@
  org.osgi.service.packageadmin; version=1.2.0, \
  org.osgi.service.startlevel; version=1.1.0, \
  org.osgi.service.url; version=1.0.0, \
- org.apache.felix.karaf.main.spi, \
- org.apache.felix.karaf.jaas.boot, \
  org.osgi.util.tracker; version=1.3.3, \
- org.apache.felix.karaf.version, \
+ org.apache.felix.karaf.main.spi; version=${karaf.osgi.version}, \
+ org.apache.felix.karaf.jaas.boot; version=${karaf.osgi.version}, \
+ org.apache.felix.karaf.version; version=${karaf.osgi.version}, \
  ${jre-${java.specification.version}}
 org.osgi.framework.bootdelegation=sun.*,com.sun.management*
 
diff --git a/karaf/assembly/src/main/filtered-resources/etc/org.apache.servicemix.features.cfg b/karaf/assembly/src/main/filtered-resources/etc/org.apache.felix.karaf.features.cfg
similarity index 100%
rename from karaf/assembly/src/main/filtered-resources/etc/org.apache.servicemix.features.cfg
rename to karaf/assembly/src/main/filtered-resources/etc/org.apache.felix.karaf.features.cfg
diff --git a/karaf/client/pom.xml b/karaf/client/pom.xml
index 283e47b..5410a63 100644
--- a/karaf/client/pom.xml
+++ b/karaf/client/pom.xml
@@ -70,7 +70,7 @@
                         <Bundle-Name>Apache Felix Karaf Shell Client</Bundle-Name>
                         <Bundle-Description>Shell client bundle for Apache Felix Karaf.</Bundle-Description>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-                        <Export-Package>org.apache.felix.karaf.client</Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Private-Package>
                             org.apache.felix.karaf.client;-split-package:=merge-first,
                             org.slf4j;-split-package:=merge-first,
diff --git a/karaf/deployer/blueprint/pom.xml b/karaf/deployer/blueprint/pom.xml
index 7ff297e..443b100 100644
--- a/karaf/deployer/blueprint/pom.xml
+++ b/karaf/deployer/blueprint/pom.xml
@@ -63,8 +63,10 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Private-Package>org.apache.felix.karaf.deployer.blueprint</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/deployer/features/pom.xml b/karaf/deployer/features/pom.xml
index 8c1e711..51ac0bc 100644
--- a/karaf/deployer/features/pom.xml
+++ b/karaf/deployer/features/pom.xml
@@ -67,8 +67,10 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-                        <Private-Package>org.apache.felix.karaf.deployer.blueprint</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
+                        <Private-Package>org.apache.felix.karaf.deployer.features</Private-Package>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/deployer/filemonitor/pom.xml b/karaf/deployer/filemonitor/pom.xml
index 7a46dc8..aa8d908 100644
--- a/karaf/deployer/filemonitor/pom.xml
+++ b/karaf/deployer/filemonitor/pom.xml
@@ -74,9 +74,9 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-                        <Export-Package>${pom.artifactId}</Export-Package>
-                        <Bundle-Activator>org.apache.felix.karaf.deployer.filemonitor.FileMonitorActivator
-                        </Bundle-Activator>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
+                        <Bundle-Activator>org.apache.felix.karaf.deployer.filemonitor.FileMonitorActivator</Bundle-Activator>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/deployer/spring/pom.xml b/karaf/deployer/spring/pom.xml
index 275b400..22d0d4f 100644
--- a/karaf/deployer/spring/pom.xml
+++ b/karaf/deployer/spring/pom.xml
@@ -63,8 +63,10 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Private-Package>org.apache.felix.karaf.deployer.spring</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/gshell/gshell-admin/pom.xml b/karaf/gshell/gshell-admin/pom.xml
index 36faa9d..e9bef99 100644
--- a/karaf/gshell/gshell-admin/pom.xml
+++ b/karaf/gshell/gshell-admin/pom.xml
@@ -89,6 +89,7 @@
                     <include>**/*</include>
                 </includes>
             </resource>
+            <!--
             <resource>
                 <directory>${pom.basedir}/src/main/filtered-resources</directory>
                 <filtering>true</filtering>
@@ -96,6 +97,7 @@
                     <include>**/*</include>
                 </includes>
             </resource>
+            -->
         </resources>
         <plugins>
             <plugin>
@@ -103,7 +105,7 @@
                 <artifactId>maven-resources-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>copy-resources</id>
+                        <id>copy-config-properties</id>
                         <!-- here the phase you need -->
                         <phase>compile</phase>
                         <goals>
@@ -111,15 +113,36 @@
                         </goals>
                         <configuration>
                             <outputDirectory>${basedir}/target/classes/org/apache/felix/karaf/gshell/admin/etc</outputDirectory>
-                            <resources>          
+                            <resources>
                                 <resource>
                                     <directory>../../${config.location}</directory>
                                     <includes>
                                         <include>config.properties</include>
                                     </includes>
                                 </resource>
-                            </resources>              
-                        </configuration>            
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-filtered</id>
+                        <!-- here the phase you need -->
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${basedir}/target/classes</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/filtered-resources</directory>
+                                    <filtering>true</filtering>
+                                    <includes>
+                                        <include>**/*.cfg</include>
+                                        <include>**/*.properties</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>            
@@ -136,8 +159,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>org.apache.felix.karaf.gshell.admin.*;version=${project.version}
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>
                             org.apache.geronimo.gshell.wisdom.command,
                             org.apache.geronimo.gshell.wisdom.registry,
@@ -145,7 +167,8 @@
                             *
                         </Import-Package>
                         <Private-Package>org.apache.felix.karaf.jpm.*</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/gshell/gshell-config/pom.xml b/karaf/gshell/gshell-config/pom.xml
index 74c0e3c..9867abb 100644
--- a/karaf/gshell/gshell-config/pom.xml
+++ b/karaf/gshell/gshell-config/pom.xml
@@ -74,9 +74,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>
-                            org.apache.felix.karaf.gshell.config*;version=${project.version};-split-package:=merge-first
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>
                             org.apache.geronimo.gshell.wisdom.command,
                             org.apache.geronimo.gshell.wisdom.registry,
@@ -84,7 +82,8 @@
                             *
                         </Import-Package>
                         <Private-Package>!*</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/gshell/gshell-core/pom.xml b/karaf/gshell/gshell-core/pom.xml
index 8747936..7b5d410 100644
--- a/karaf/gshell/gshell-core/pom.xml
+++ b/karaf/gshell/gshell-core/pom.xml
@@ -37,35 +37,6 @@
         Provides the OSGi GShell integration
     </description>
 
-    <properties>
-        <gshell.osgi.import>
-            org.springframework.aop,
-            org.springframework.aop.framework,
-            org.springframework.beans.factory.annotation,
-            org.springframework.context.annotation,
-            org.springframework.osgi.service.importer,
-            org.aopalliance.aop,
-            org.apache.commons.vfs.provider.temp,
-            org.apache.commons.vfs.provider.ram,
-            jline*,
-            org.apache.felix.karaf.jaas.config;resolution:=optional,
-            org.apache.felix.karaf.version;resolution:=optional, 
-            org.apache.felix.karaf.main.spi;resolution:=optional;version="1.0.0",
-            org.codehaus.plexus*;resolution:=optional,
-            org.apache.sshd.server.keyprovider,
-            org.apache.sshd.server.jaas,
-            org.jsecurity*;resolution:=optional,
-            *
-        </gshell.osgi.import>
-        <!-- TODO: remove plexus util package -->
-        <gshell.osgi.export>
-            org.apache.geronimo.gshell*;version="1.0.0.alpha-2-SNAPSHOT";-split-package:=merge-first,
-            org.apache.felix.karaf.gshell.core*,
-            org.codehaus.plexus.interpolation*;-split-package:=merge-first,
-            org.codehaus.plexus.util;-split-package:=merge-first
-        </gshell.osgi.export>
-    </properties>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.felix.karaf</groupId>
@@ -111,10 +82,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.gshell.commands</groupId>
-            <artifactId>gshell-ssh</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.gshell.commands</groupId>
             <artifactId>gshell-text</artifactId>
         </dependency>
         <dependency>
@@ -136,10 +103,6 @@
             </exclusions>
         </dependency>
         <dependency>
-            <groupId>org.codehaus.plexus</groupId>
-            <artifactId>plexus-utils</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
         </dependency>
@@ -204,19 +167,6 @@
             <groupId>org.apache.servicemix.bundles</groupId>
             <artifactId>org.apache.servicemix.bundles.jline</artifactId>
         </dependency>
-        
-        <!-- jsecurity is a dependency for the ssh commands -->
-        <dependency>
-            <groupId>org.jsecurity</groupId>
-            <artifactId>jsecurity</artifactId>
-            <version>0.9.0-RC2</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>commons-logging</groupId>
-                    <artifactId>commons-logging</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
     </dependencies>
 
     <build>
@@ -249,9 +199,32 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Import-Package>${gshell.osgi.import}</Import-Package>
-                        <Export-Package>${gshell.osgi.export}</Export-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Import-Package>
+                            org.springframework.aop,
+                            org.springframework.aop.framework,
+                            org.springframework.beans.factory.annotation,
+                            org.springframework.context.annotation,
+                            org.springframework.osgi.service.importer,
+                            org.aopalliance.aop,
+                            org.apache.commons.vfs.provider.temp,
+                            org.apache.commons.vfs.provider.ram,
+                            jline*,
+                            org.apache.felix.karaf.jaas.config;resolution:=optional,
+                            org.apache.felix.karaf.version;resolution:=optional,
+                            org.apache.felix.karaf.main.spi;resolution:=optional;version="1.0.0",
+                            org.apache.sshd.server.keyprovider,
+                            org.apache.sshd.server.jaas,
+                            *
+                        </Import-Package>
+                        <Export-Package>
+                            org.apache.geronimo.gshell*;version="1.0.0.alpha-2";-split-package:=merge-first,
+                            org.apache.felix.karaf.gshell.core*;version=${project.version};-split-package:=merge-first,
+                        </Export-Package>
+                        <Private-Package>
+                            org.codehaus.plexus.interpolation*,
+                        </Private-Package>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                     <unpackBundle>true</unpackBundle>
                 </configuration>
@@ -285,7 +258,6 @@
                                     <include>org.apache.geronimo.gshell.support:gshell-i18n</include>
                                     <include>org.apache.geronimo.gshell.support:gshell-interpolation</include>
                                     <include>org.apache.geronimo.gshell.support:gshell-io</include>
-                                    <include>org.apache.geronimo.gshell.support:gshell-security</include>
                                     <include>org.apache.geronimo.gshell.support:gshell-spring</include>
                                     <include>org.apache.geronimo.gshell.support:gshell-terminal</include>
                                     <include>org.apache.geronimo.gshell.support:gshell-vfs</include>
@@ -293,7 +265,6 @@
                                     <include>org.apache.geronimo.gshell.support:gshell-yarn</include>
                                     <include>org.apache.geronimo.gshell.wisdom:gshell-wisdom-core</include>
                                     <include>org.apache.geronimo.gshell.wisdom:gshell-wisdom-bootstrap</include>
-                                    <include>org.codehaus.plexus:plexus-utils</include>
                                     <include>org.codehaus.plexus:plexus-interpolation</include>
                                     <include>${project.groupId}:${project.artifactId}</include>
                                 </includes>
@@ -342,12 +313,6 @@
                                     </excludes>
                                 </filter>
                                 <filter>
-                                    <artifact>org.apache.geronimo.gshell.commands:gshell-ssh</artifact>
-                                    <excludes>
-                                        <exclude>org/apache/geronimo/gshell/**</exclude>
-                                    </excludes>
-                                </filter>
-                                <filter>
                                     <artifact>org.apache.geronimo.gshell.commands:gshell-text</artifact>
                                     <excludes>
                                         <exclude>org/apache/geronimo/gshell/**</exclude>
@@ -408,12 +373,6 @@
                                     </excludes>
                                 </filter>
                                 <filter>
-                                    <artifact>org.apache.geronimo.gshell.support:gshell-security</artifact>
-                                    <excludes>
-                                        <exclude>org/apache/geronimo/gshell/**</exclude>
-                                    </excludes>
-                                </filter>
-                                <filter>
                                     <artifact>org.apache.geronimo.gshell.support:gshell-spring</artifact>
                                     <excludes>
                                         <exclude>org/apache/geronimo/gshell/**</exclude>
@@ -456,12 +415,6 @@
                                     </excludes>
                                 </filter>
                                 <filter>
-                                    <artifact>org.codehaus.plexus:plexus-utils</artifact>
-                                    <excludes>
-                                        <exclude>org/codehaus/plexus/**</exclude>
-                                    </excludes>
-                                </filter>
-                                <filter>
                                     <artifact>org.codehaus.plexus:plexus-interpolation</artifact>
                                     <excludes>
                                         <exclude>org/codehaus/plexus/**</exclude>
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/commands/InfoAction.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/commands/InfoAction.java
index ba09d82..6f62660 100644
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/commands/InfoAction.java
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/commands/InfoAction.java
@@ -37,7 +37,6 @@
 import org.apache.geronimo.gshell.command.CommandContext;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.felix.karaf.gshell.core.DefaultBranding;
-import org.codehaus.plexus.util.StringUtils;
 
 public class InfoAction implements CommandAction {
 
@@ -171,7 +170,24 @@
     }
 
     void printValue(String name, int pad, String value) {
-        io.out.println("  " + renderer.render(AnsiRenderer.encode(StringUtils.rightPad(name, pad), AnsiCode.BOLD)) + "   " + value);
+        io.out.println("  " + renderer.render(AnsiRenderer.encode(rightPad(name, pad, " "), AnsiCode.BOLD)) + "   " + value);
     }
 
+    //==== Plexus StringUtils =====
+
+    public static String rightPad( String str, int size, String delim ) {
+        size = ( size - str.length() ) / delim.length();
+        if ( size > 0 ) {
+            str += repeat( delim, size );
+        }
+        return str;
+    }
+
+    public static String repeat( String str, int repeat ) {
+        StringBuffer buffer = new StringBuffer( repeat * str.length() );
+        for ( int i = 0; i < repeat; i++ ) {
+            buffer.append( str );
+        }
+        return buffer.toString();
+    }
 }
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java b/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java
deleted file mode 100644
index d3bb6de..0000000
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.geronimo.gshell.commands.ssh;
-
-import org.apache.sshd.server.PasswordAuthenticator;
-import org.jsecurity.SecurityUtils;
-import org.jsecurity.authc.AuthenticationException;
-import org.jsecurity.authc.UsernamePasswordToken;
-import org.jsecurity.mgt.SecurityManager;
-import org.jsecurity.subject.Subject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <a href="http://jsecurity.org">JSecurity</a> {@link PasswordAuthenticator}.
- *
- * @version $Rev: 722797 $ $Date: 2008-12-03 08:18:16 +0100 (Wed, 03 Dec 2008) $
- */
-public class JSecurityPasswordAuthenticator
-    implements PasswordAuthenticator
-{
-    private final Logger log = LoggerFactory.getLogger(getClass());
-
-    private final SecurityManager securityManager;
-
-    public JSecurityPasswordAuthenticator(final SecurityManager securityManager) {
-        // securityManager can be null
-        this.securityManager = securityManager;
-    }
-
-    public JSecurityPasswordAuthenticator() {
-        this(null);
-    }
-
-    public Object authenticate(final String username, final String password) {
-        assert username != null;
-        assert password != null;
-
-        log.debug("Authenticating: {}/{}", username, password);
-
-        Subject currentUser;
-
-        if (securityManager != null) {
-            currentUser = securityManager.getSubject();
-        }
-        else {
-            currentUser = SecurityUtils.getSubject();
-        }
-
-        if (currentUser.isAuthenticated()) {
-            log.debug("Logging out current user: {}", currentUser.getPrincipal());
-            currentUser.logout();
-        }
-
-        try {
-            UsernamePasswordToken token = new UsernamePasswordToken(username, password);
-            currentUser.login(token);
-            Object principal = currentUser.getPrincipal();
-            log.info("User [{}] logged in successfully", principal);
-            return principal;
-        }
-        catch (AuthenticationException e) {
-            log.error("Authentication failed: " + e, e);
-            return null;
-        }
-    }
-}
diff --git a/karaf/gshell/gshell-features/pom.xml b/karaf/gshell/gshell-features/pom.xml
index 0d7c34d..9f41944 100644
--- a/karaf/gshell/gshell-features/pom.xml
+++ b/karaf/gshell/gshell-features/pom.xml
@@ -90,8 +90,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>org.apache.felix.karaf.gshell.features*;version=${project.version}
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>
                             org.apache.geronimo.gshell.wisdom.command,
                             org.apache.felix.karaf.gshell.core,
@@ -100,7 +99,8 @@
                             *
                         </Import-Package>
                         <Private-Package>!*</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/gshell/gshell-log/pom.xml b/karaf/gshell/gshell-log/pom.xml
index 6ed4fe1..54f765d 100644
--- a/karaf/gshell/gshell-log/pom.xml
+++ b/karaf/gshell/gshell-log/pom.xml
@@ -75,9 +75,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>
-                            org.apache.felix.karaf.gshell.log*;version=${project.version};-split-package:=merge-first
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>
                             org.apache.geronimo.gshell.wisdom.command,
                             org.apache.geronimo.gshell.wisdom.registry,
@@ -86,7 +84,8 @@
                             *
                         </Import-Package>
                         <Private-Package>!*</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/gshell/gshell-obr/pom.xml b/karaf/gshell/gshell-obr/pom.xml
index 497c0d6..6ade759 100644
--- a/karaf/gshell/gshell-obr/pom.xml
+++ b/karaf/gshell/gshell-obr/pom.xml
@@ -68,7 +68,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>org.apache.felix.karaf.gshell.obr*;version=${project.version}</Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>
                             org.apache.geronimo.gshell.wisdom.command,
                             org.apache.geronimo.gshell.wisdom.registry,
@@ -76,7 +76,8 @@
                             *
                         </Import-Package>
                         <Private-Package>!*</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/gshell/gshell-osgi/pom.xml b/karaf/gshell/gshell-osgi/pom.xml
index f4d460e..b0af3a7 100644
--- a/karaf/gshell/gshell-osgi/pom.xml
+++ b/karaf/gshell/gshell-osgi/pom.xml
@@ -68,9 +68,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>
-                            org.apache.felix.karaf.gshell.osgi*;version=${project.version};-split-package:=merge-first
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>
                             org.apache.geronimo.gshell.wisdom.command,
                             org.apache.geronimo.gshell.wisdom.registry,
@@ -78,7 +76,8 @@
                             *
                         </Import-Package>
                         <Private-Package>!*</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/gshell/gshell-packages/pom.xml b/karaf/gshell/gshell-packages/pom.xml
index b8a90d6..8479242 100644
--- a/karaf/gshell/gshell-packages/pom.xml
+++ b/karaf/gshell/gshell-packages/pom.xml
@@ -69,9 +69,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>
-                            org.apache.felix.karaf.gshell.packages*;version=${project.version};-split-package:=merge-first
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>
                             org.apache.geronimo.gshell.wisdom.command,
                             org.apache.geronimo.gshell.wisdom.registry,
@@ -79,7 +77,8 @@
                             *
                         </Import-Package>
                         <Private-Package>!*</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/gshell/gshell-wrapper/pom.xml b/karaf/gshell/gshell-wrapper/pom.xml
index 91d2d26..ef6cc5a 100644
--- a/karaf/gshell/gshell-wrapper/pom.xml
+++ b/karaf/gshell/gshell-wrapper/pom.xml
@@ -97,8 +97,7 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>org.apache.felix.karaf.gshell.wrapper.*;version=${project.version}
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>
                             org.apache.geronimo.gshell.wisdom.command,
                             org.apache.geronimo.gshell.wisdom.registry,
@@ -106,7 +105,8 @@
                             *
                         </Import-Package>
                         <Private-Package>!*</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/jaas/jaas-boot/pom.xml b/karaf/jaas/jaas-boot/pom.xml
index 022e6e3..e064b26 100644
--- a/karaf/jaas/jaas-boot/pom.xml
+++ b/karaf/jaas/jaas-boot/pom.xml
@@ -53,10 +53,10 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>${artifactId}*;version=${project.version};-split-package:=merge-first
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>*</Import-Package>
                         <Private-Package>!*</Private-Package>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/jaas/jaas-config/pom.xml b/karaf/jaas/jaas-config/pom.xml
index 3c9c0b3..9055ecf 100644
--- a/karaf/jaas/jaas-config/pom.xml
+++ b/karaf/jaas/jaas-config/pom.xml
@@ -81,12 +81,11 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>
-                            ${artifactId};version=${project.version};-split-package:=merge-first
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>*</Import-Package>
                         <Private-Package>${artifactId}.impl</Private-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/jaas/jaas-modules/pom.xml b/karaf/jaas/jaas-modules/pom.xml
index 07af5aa..9c873c8 100644
--- a/karaf/jaas/jaas-modules/pom.xml
+++ b/karaf/jaas/jaas-modules/pom.xml
@@ -74,15 +74,14 @@
                 <configuration>
                     <instructions>
                         <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
-                        <Export-Package>
-                            org.apache.felix.karaf.jaas.modules*;version=${project.version};-split-package:=merge-first
-                        </Export-Package>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
                         <Import-Package>
                             org.apache.felix.karaf.jaas.config,
                             org.springframework.beans.factory.config,
                             *
                         </Import-Package>
-                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/management/pom.xml b/karaf/management/pom.xml
index dfc5997..d00e5c6 100644
--- a/karaf/management/pom.xml
+++ b/karaf/management/pom.xml
@@ -68,8 +68,9 @@
                             javax.management,
                             *
                         </Import-Package>
-                        <Export-Package>org.apache.felix.karaf.management*</Export-Package>
-                        <Spring-Context>*;publish-context:=false</Spring-Context>
+                        <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+                        <_versionpolicy>${bnd.version.policy}</_versionpolicy>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/karaf/pom.xml b/karaf/pom.xml
index a107205..50520e9 100644
--- a/karaf/pom.xml
+++ b/karaf/pom.xml
@@ -76,7 +76,7 @@
         <depends.maven.plugin.version>1.0</depends.maven.plugin.version>
         <easymock.version>2.4</easymock.version>
         <felix.configadmin.version>1.0.4</felix.configadmin.version>
-        <felix.plugin.version>1.4.3</felix.plugin.version>
+        <felix.plugin.version>2.0.0</felix.plugin.version>
         <felix.framework.version>1.6.0</felix.framework.version>
         <felix.osgi.version>1.2.0</felix.osgi.version>
         <felix.compendium.version>1.2.0</felix.compendium.version>
@@ -103,6 +103,9 @@
         <osgi.jmx.version>1.0-r6125-patched</osgi.jmx.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+        <karaf.osgi.version>1.2.0</karaf.osgi.version>
+        <bnd.version.policy>[$(version;==;$(@)),$(version;+;$(@)))</bnd.version.policy>
     </properties>
 
     <repositories>