Consolidate gRPC OSGi bundle handling

Change-Id: I01e5058e08372b142058769db081b8de154e1c9b
diff --git a/incubator/protobuf/features.xml b/incubator/protobuf/features.xml
index c19a13b..e8fbc06 100644
--- a/incubator/protobuf/features.xml
+++ b/incubator/protobuf/features.xml
@@ -18,7 +18,7 @@
     <feature name="${project.artifactId}" version="${project.version}"
              description="${project.description}">
         <feature>onos-api</feature>
-        <bundle>mvn:com.google.protobuf/protobuf-java/3.0.0</bundle>
+        <bundle>mvn:com.google.protobuf/protobuf-java/${protobuf.version}</bundle>
         <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
     </feature>
 </features>
diff --git a/incubator/protobuf/pom.xml b/incubator/protobuf/pom.xml
index 10246c4..c5969fc 100644
--- a/incubator/protobuf/pom.xml
+++ b/incubator/protobuf/pom.xml
@@ -125,9 +125,6 @@
                 <artifactId>protobuf-maven-plugin</artifactId>
                 <version>0.5.0</version>
                 <configuration>
-                    <!-- The version of protoc must match protobuf-java. If you don't 
-                        depend on protobuf-java directly, you will be transitively depending on the 
-                        protobuf-java version that grpc depends on. -->
                     <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
                 </configuration>
                 <executions>
diff --git a/incubator/rpc-grpc/features.xml b/incubator/rpc-grpc/features.xml
index 4061b6e..e643647 100644
--- a/incubator/rpc-grpc/features.xml
+++ b/incubator/rpc-grpc/features.xml
@@ -17,26 +17,8 @@
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.2.1" name="${project.artifactId}-${project.version}">
     <feature name="${project.artifactId}" version="${project.version}"
              description="${project.description}">
-        <feature>onos-api</feature>
-        <bundle>mvn:com.google.protobuf/protobuf-java/3.0.0</bundle>
-        <bundle>mvn:io.netty/netty-common/4.1.3.Final</bundle>
-        <bundle>mvn:io.netty/netty-buffer/4.1.3.Final</bundle>
-        <bundle>mvn:io.netty/netty-transport/4.1.3.Final</bundle>
-        <bundle>mvn:io.netty/netty-handler/4.1.3.Final</bundle>
-        <bundle>mvn:io.netty/netty-codec/4.1.3.Final</bundle>
-        <bundle>mvn:io.netty/netty-codec-http/4.1.3.Final</bundle>
-        <bundle>mvn:io.netty/netty-codec-http2/4.1.3.Final</bundle>
-        <bundle>mvn:io.netty/netty-resolver/4.1.3.Final</bundle>
-        <!-- TODO: Create shaded jar for these. -->
-        <bundle>wrap:mvn:com.google.auth/google-auth-library-credentials/0.4.0$Bundle-SymbolicName=com.google.auth.google-auth-library-credentials&amp;Bundle-Version=0.4.0</bundle>
-        <bundle>wrap:mvn:com.google.auth/google-auth-library-oauth2-http/0.4.0$Bundle-SymbolicName=com.google.auth.google-auth-library-oauth2-http&amp;Bundle-Version=0.4.0</bundle>
-        <!-- io.grpc.internal required for DnsNameResolverProvider -->
-        <bundle>wrap:mvn:io.grpc/grpc-core/1.0.0-pre2$Bundle-SymbolicName=io.grpc.grpc-core&amp;Bundle-Version=1.0.0&amp;Export-Package=*;version=1.0.0,io.grpc.internal;version=1.0.0&amp;</bundle>
-        <bundle>wrap:mvn:io.grpc/grpc-protobuf-lite/1.0.0-pre2$Bundle-SymbolicName=io.grpc.grpc-protobuf-lite&amp;Bundle-Version=1.0.0&amp;</bundle>
-        <bundle>wrap:mvn:io.grpc/grpc-protobuf/1.0.0-pre2$Bundle-SymbolicName=io.grpc.grpc-protobuf&amp;Bundle-Version=1.0.0&amp;</bundle>
-        <bundle>wrap:mvn:io.grpc/grpc-stub/1.0.0-pre2$Bundle-SymbolicName=io.grpc.grpc-stub&amp;Bundle-Version=1.0.0&amp;</bundle>
-        <bundle>wrap:mvn:io.grpc/grpc-netty/1.0.0-pre2$Bundle-SymbolicName=io.grpc.grpc-netty&amp;Bundle-Version=1.0.0&amp;Import-Package=io.netty.*;version=4.1.3,*</bundle>
-        <bundle>wrap:mvn:io.grpc/grpc-auth/1.0.0-pre2$Bundle-SymbolicName=io.grpc.grpc-auth&amp;Bundle-Version=1.0.0&amp;Import-Package=javax.net.ssl,*</bundle>
+        <feature version="${project.version}">onos-api</feature>
+
         <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
     </feature>
 </features>
diff --git a/incubator/rpc-grpc/pom.xml b/incubator/rpc-grpc/pom.xml
index d8e75b7..832ac73 100644
--- a/incubator/rpc-grpc/pom.xml
+++ b/incubator/rpc-grpc/pom.xml
@@ -33,10 +33,10 @@
         <onos.app.title>ONOS gRPC API</onos.app.title>
         <onos.app.requires>
             org.onosproject.incubator.rpc,
-            org.onosproject.incubator.protobuf
+            org.onosproject.incubator.protobuf,
+            org.onosproject.incubator.grpc
         </onos.app.requires>
         <protobuf.version>3.0.0</protobuf.version>
-        <!-- Note: update feature.xml when updating -->
         <grpc.version>1.0.0-pre2</grpc.version>
         <grpc.netty.version>4.1.3.Final</grpc.netty.version>
     </properties>
@@ -72,16 +72,6 @@
             <artifactId>grpc-stub</artifactId>
             <version>${grpc.version}</version>
         </dependency>
-        <dependency>
-            <groupId>io.grpc</groupId>
-            <artifactId>grpc-netty</artifactId>
-            <version>${grpc.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>io.grpc</groupId>
-            <artifactId>grpc-auth</artifactId>
-            <version>${grpc.version}</version>
-        </dependency>
 
         <dependency>
             <groupId>junit</groupId>
@@ -103,6 +93,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-incubator-grpc</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.scr.annotations</artifactId>
             <scope>provided</scope>
@@ -151,10 +147,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                </configuration>
             </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>