You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by mm...@apache.org on 2021/03/23 21:04:21 UTC

[bookkeeper] branch master updated: ISSUE-2640: BP-43: Build :stream source with gradle (#2657)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 79a9aff  ISSUE-2640: BP-43: Build :stream source with gradle (#2657)
79a9aff is described below

commit 79a9aff42a16512c9ad9d48609fbd973b4083965
Author: Prashant Kumar <65...@users.noreply.github.com>
AuthorDate: Tue Mar 23 14:04:14 2021 -0700

    ISSUE-2640: BP-43: Build :stream source with gradle (#2657)
    
    Add maven publication with the group and artifact ids fixed up to what
    maven was generating.
    
    Co-authored-by: Ivan Kelly <ik...@splunk.com>
---
 bookkeeper-common/build.gradle                     | 12 -----
 .../vertx-http-server}/build.gradle                | 14 ++++-
 bookkeeper-server/build.gradle                     |  1 -
 .../prometheus-metrics-provider/build.gradle       |  8 +++
 bookkeeper-stats/build.gradle                      |  9 ++++
 build.gradle                                       | 35 ++++++++++++-
 dependencies.gradle                                | 20 ++++++++
 settings.gradle                                    |  8 ++-
 {bookkeeper-stats => stream/api}/build.gradle      | 21 ++++++--
 .../clients/java/all}/build.gradle                 | 39 ++++++++------
 .../clients/java/base}/build.gradle                | 37 +++++++------
 .../clients/java/kv}/build.gradle                  | 28 +++++-----
 .../common}/build.gradle                           | 31 ++++++-----
 .../distributedlog/common}/build.gradle            | 32 +++++++-----
 .../distributedlog/core}/build.gradle              | 58 +++++++++------------
 .../distributedlog/protocol}/build.gradle          | 31 ++++++-----
 build.gradle => stream/proto/build.gradle          | 44 +++++++++++-----
 stream/server/build.gradle                         | 51 ++++++++++++++++++
 .../statelib}/build.gradle                         | 60 ++++++++++++----------
 .../storage/api}/build.gradle                      | 18 +++++--
 stream/storage/impl/build.gradle                   | 57 ++++++++++++++++++++
 .../tests-common}/build.gradle                     | 25 ++++++++-
 22 files changed, 450 insertions(+), 189 deletions(-)

diff --git a/bookkeeper-common/build.gradle b/bookkeeper-common/build.gradle
index d4f3f43..27a9a06 100644
--- a/bookkeeper-common/build.gradle
+++ b/bookkeeper-common/build.gradle
@@ -49,15 +49,3 @@ dependencies {
     testAnnotationProcessor depLibs.lombok
 }
 
-configurations {
-    testArtifacts.extendsFrom testRuntime
-}
-
-task testJar(type: Jar) {
-    archiveClassifier.set('test')
-    from sourceSets.test.output
-}
-
-artifacts {
-    testArtifacts testJar
-}
diff --git a/bookkeeper-stats/build.gradle b/bookkeeper-http/vertx-http-server/build.gradle
similarity index 71%
copy from bookkeeper-stats/build.gradle
copy to bookkeeper-http/vertx-http-server/build.gradle
index 9507cc8..bc01765 100644
--- a/bookkeeper-stats/build.gradle
+++ b/bookkeeper-http/vertx-http-server/build.gradle
@@ -21,6 +21,18 @@ plugins {
 }
 
 dependencies {
-    implementation depLibs.commonsConfiguration
+    implementation project(':bookkeeper-http:http-server')
     implementation depLibs.slf4j
+    implementation depLibs.vertxCore
+    implementation depLibs.vertxWeb
+    testImplementation depLibs.junit
+}
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            groupId = 'org.apache.bookkeeper.http'
+            artifactId = 'vertx-http-server'
+        }
+    }
 }
diff --git a/bookkeeper-server/build.gradle b/bookkeeper-server/build.gradle
index 4401de1..0d9ddbe 100644
--- a/bookkeeper-server/build.gradle
+++ b/bookkeeper-server/build.gradle
@@ -84,4 +84,3 @@ test.doFirst {
     jvmArgs("-javaagent:${junitFoundation.file}", "-Djunit.timeout.test=600000", "-Djunit.max.retry=3",
             "-Djava.net.preferIPv4Stack=true", "-Dio.netty.leakDetection.level=paranoid")
 }
-
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle b/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
index ca9d215..f51d059 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
+++ b/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
@@ -36,3 +36,11 @@ dependencies {
     testImplementation depLibs.junit
     testAnnotationProcessor depLibs.lombok
 }
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            groupId = 'org.apache.bookkeeper.stats'
+        }
+    }
+}
diff --git a/bookkeeper-stats/build.gradle b/bookkeeper-stats/build.gradle
index 9507cc8..70167df 100644
--- a/bookkeeper-stats/build.gradle
+++ b/bookkeeper-stats/build.gradle
@@ -24,3 +24,12 @@ dependencies {
     implementation depLibs.commonsConfiguration
     implementation depLibs.slf4j
 }
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            groupId = 'org.apache.bookkeeper.stats'
+            artifactId = 'bookkeeper-stats-api'
+        }
+    }
+}
diff --git a/build.gradle b/build.gradle
index 2e96e6a..a478817 100644
--- a/build.gradle
+++ b/build.gradle
@@ -30,6 +30,39 @@ plugins {
 allprojects {
     apply from: "$rootDir/dependencies.gradle"
 
+    if (it.path != ':circe-checksum:src:main:circe'
+        && it.path != ':cpu-affinity:src:main:affinity'
+        && it.name != 'src'
+        && it.name != 'main') {
+        apply plugin: 'java'
+        apply plugin: 'maven-publish'
+
+        task testJar(type: Jar, dependsOn: testClasses) {
+            classifier = 'tests'
+            from sourceSets.test.output
+        }
+
+        configurations {
+            testArtifacts.extendsFrom testRuntime
+        }
+
+        artifacts {
+            testArtifacts testJar
+        }
+
+        def componentName = it.name
+        publishing {
+            publications {
+                maven(MavenPublication) {
+                    groupId = 'org.apache.bookkeeper'
+                    artifactId = componentName
+                    from components.java
+                    artifact testJar
+                }
+            }
+        }
+    }
+
     repositories {
         mavenCentral()
     }
@@ -37,4 +70,4 @@ allprojects {
 
 pluginManager.withPlugin('java') {
     sourceCompatibility = targetCompatibility = 8
-}
\ No newline at end of file
+}
diff --git a/dependencies.gradle b/dependencies.gradle
index a47ced9..89089cc 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -29,8 +29,12 @@ depVersions = [
     commonsCollections4: "4.1",
     commonsConfiguration: "1.10",
     commonsIO: "2.4",
+    commonsLang2: "2.6",
     commonsLang3: "3.6",
+    curator: "4.0.1",
     errorprone: "2.1.2",
+    freebuilder: "1.14.9",
+    grpc: "1.33.0",
     guava: "21.0",
     hamcrest: "1.3",
     httpclient: "4.5.13",
@@ -38,6 +42,7 @@ depVersions = [
     jcommander: "1.78",
     jctools: "2.1.2",
     jetty: "9.4.5.v20170502",
+    jmock: "2.8.2",
     jna: "3.2.7",
     jsr305: "3.0.2",
     junit: "4.12",
@@ -45,6 +50,7 @@ depVersions = [
     kerby: "1.1.1",
     log4j: "1.2.17",
     lombok: "1.18.10",
+    lz4: "1.3.0",
     mockito: "3.0.0",
     netty: "4.1.32.Final",
     nettyTcnativeBoringSsl: "2.0.20.Final",
@@ -54,6 +60,9 @@ depVersions = [
     rocksDb: "6.13.3",
     slf4j: "1.7.25",
     spotbugsAnnotations: "3.1.8",
+    protocGenGrpcJava: "1.12.0",
+    thrift: "0.9.3",
+    vertx: "3.4.1",
     yahooDatasketches: "0.8.3",
     zookeeper: "3.4.13",
 ]
@@ -67,8 +76,13 @@ depLibs = [
     commonsCollections4: "org.apache.commons:commons-collections4:${depVersions.commonsCollections4}",
     commonsConfiguration: "commons-configuration:commons-configuration:${depVersions.commonsConfiguration}",
     commonsIO: "commons-io:commons-io:${depVersions.commonsIO}",
+    commonsLang2: "commons-lang:commons-lang:${depVersions.commonsLang2}",
     commonsLang3: "org.apache.commons:commons-lang3:${depVersions.commonsLang3}",
+    curatorFramework: "org.apache.curator:curator-framework:${depVersions.curator}",
+    curatorRecipes: "org.apache.curator:curator-recipes:${depVersions.curator}",
     errorprone: "com.google.errorprone:error_prone_annotations:${depVersions.errorprone}",
+    freebuilder: "org.inferred:freebuilder:${depVersions.freebuilder}",
+    grpc: "io.grpc:grpc-all:${depVersions.grpc}",
     guava: "com.google.guava:guava:${depVersions.guava}",
     hamcrest: "org.hamcrest:hamcrest-all:${depVersions.hamcrest}",
     httpclient: "org.apache.httpcomponents:httpclient:${depVersions.httpclient}",
@@ -78,6 +92,7 @@ depLibs = [
     jcommander: "com.beust:jcommander:${depVersions.jcommander}",
     jctools: "org.jctools:jctools-core:${depVersions.jctools}",
     jettyServlet: "org.eclipse.jetty:jetty-servlet:${depVersions.jetty}",
+    jmock: "org.jmock:jmock:${depVersions.jmock}",
     jna: "net.java.dev.jna:jna:${depVersions.jna}",
     jsr305: "com.google.code.findbugs:jsr305:${depVersions.jsr305}",
     junit: "junit:junit:${depVersions.junit}",
@@ -85,6 +100,7 @@ depLibs = [
     kerbySimpleKdc: "org.apache.kerby:kerb-simplekdc:${depVersions.kerby}",
     log4j: "log4j:log4j:${depVersions.log4j}",
     lombok: "org.projectlombok:lombok:${depVersions.lombok}",
+    lz4: "net.jpountz.lz4:lz4:${depVersions.lz4}",
     mockito: "org.mockito:mockito-core:${depVersions.mockito}",
     nettyBuffer: "io.netty:netty-buffer:${depVersions.netty}",
     nettyCommon: "io.netty:netty-common:${depVersions.netty}",
@@ -97,11 +113,15 @@ depLibs = [
     prometheusSimpleClientHotspot: "io.prometheus:simpleclient_hotspot:${depVersions.prometheus}",
     prometheusSimpleClientServlet: "io.prometheus:simpleclient_servlet:${depVersions.prometheus}",
     protobuf: "com.google.protobuf:protobuf-java:${depVersions.protobuf}",
+    protocGenGrpcJava: "io.grpc:protoc-gen-grpc-java:${depVersions.protocGenGrpcJava}",
     protoc: "com.google.protobuf:protoc:${depVersions.protobuf}",
     rocksDb: "org.rocksdb:rocksdbjni:${depVersions.rocksDb}",
     slf4j: "org.slf4j:slf4j-api:${depVersions.slf4j}",
     slf4jLog4j: "org.slf4j:slf4j-log4j12:${depVersions.slf4j}",
     spotbugsAnnotations: "com.github.spotbugs:spotbugs-annotations:${depVersions.spotbugsAnnotations}",
+    thrift: "org.apache.thrift:libthrift:${depVersions.thrift}",
+    vertxCore: "io.vertx:vertx-core:${depVersions.vertx}",
+    vertxWeb: "io.vertx:vertx-web:${depVersions.vertx}",
     yahooDatasketches: "com.yahoo.datasketches:sketches-core:${depVersions.yahooDatasketches}",
     zookeeper: "org.apache.zookeeper:zookeeper:${depVersions.zookeeper}",
     zookeeperTest: "org.apache.zookeeper:zookeeper:${depVersions.zookeeper}:tests",
diff --git a/settings.gradle b/settings.gradle
index 7bf66ea..44e76bd 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -29,4 +29,10 @@ include('circe-checksum', 'circe-checksum:src:main:circe',
         'bookkeeper-http:http-server', 'bookkeeper-server',
         'bookkeeper-common-allocator', 'bookkeeper-proto', 'bookkeeper-stats',
         'bookkeeper-stats-providers:prometheus-metrics-provider',
-        'tools:framework')
+        'tools:framework',
+        'stream:distributedlog:common', 'stream:distributedlog:protocol', 'stream:distributedlog:core',
+        'stream:api', 'stream:common', 'stream:proto', 'stream:statelib',
+        'stream:storage:api', 'stream:storage:impl', 'stream:server',
+        'stream:clients:java:all', 'stream:clients:java:base', 'stream:clients:java:kv',
+        'stream:tests-common')
+
diff --git a/bookkeeper-stats/build.gradle b/stream/api/build.gradle
similarity index 66%
copy from bookkeeper-stats/build.gradle
copy to stream/api/build.gradle
index 9507cc8..9be37a7 100644
--- a/bookkeeper-stats/build.gradle
+++ b/stream/api/build.gradle
@@ -16,11 +16,22 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-plugins {
-    id 'java'
+dependencies {
+    implementation project(':bookkeeper-common')
+    implementation project(':stream:common')
+
+    implementation depLibs.guava
+    implementation depLibs.lombok
+    implementation depLibs.nettyBuffer
+    implementation depLibs.nettyCommon
+
+    annotationProcessor depLibs.lombok
 }
 
-dependencies {
-    implementation depLibs.commonsConfiguration
-    implementation depLibs.slf4j
+publishing {
+    publications {
+        maven(MavenPublication) {
+            artifactId = 'stream-storage-api'
+        }
+    }
 }
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle b/stream/clients/java/all/build.gradle
similarity index 53%
copy from bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
copy to stream/clients/java/all/build.gradle
index ca9d215..9b19abc 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
+++ b/stream/clients/java/all/build.gradle
@@ -16,23 +16,30 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-plugins {
-    id 'java'
-}
-
 dependencies {
-    implementation project(":bookkeeper-stats")
-    implementation depLibs.commonsConfiguration
-    implementation depLibs.guava
-    implementation depLibs.jettyServlet
-    implementation depLibs.nettyCommon
-    implementation depLibs.prometheusSimpleClient
-    implementation depLibs.prometheusSimpleClientHotspot
-    implementation depLibs.prometheusSimpleClientServlet
+    implementation project(':bookkeeper-common')
+    implementation project(':stream:api')
+    implementation project(':stream:common')
+    implementation project(':stream:clients:java:base')
+    implementation project(':stream:clients:java:kv')
+    implementation project(':stream:proto')
+
+    implementation depLibs.grpc
+    implementation depLibs.lombok
     implementation depLibs.slf4j
-    implementation depLibs.yahooDatasketches
 
-    testCompileOnly depLibs.lombok
-    testImplementation depLibs.junit
-    testAnnotationProcessor depLibs.lombok
+    testImplementation project(path: ':stream:clients:java:base', configuration: 'testArtifacts')
+    testImplementation depLibs.mockito
+    testImplementation depLibs.powermockJunit
+    testImplementation depLibs.powermockMockito
+
+    annotationProcessor depLibs.lombok
+}
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            artifactId = 'stream-storage-java-client'
+        }
+    }
 }
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle b/stream/clients/java/base/build.gradle
similarity index 59%
copy from bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
copy to stream/clients/java/base/build.gradle
index ca9d215..8cf5fe8 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
+++ b/stream/clients/java/base/build.gradle
@@ -16,23 +16,28 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-plugins {
-    id 'java'
-}
-
 dependencies {
-    implementation project(":bookkeeper-stats")
-    implementation depLibs.commonsConfiguration
-    implementation depLibs.guava
-    implementation depLibs.jettyServlet
-    implementation depLibs.nettyCommon
-    implementation depLibs.prometheusSimpleClient
-    implementation depLibs.prometheusSimpleClientHotspot
-    implementation depLibs.prometheusSimpleClientServlet
+    implementation project(':bookkeeper-common')
+    implementation project(':bookkeeper-stats')
+    implementation project(':stream:common')
+    implementation project(':stream:proto')
+
+    implementation depLibs.commonsLang2
+    implementation depLibs.freebuilder
+    implementation depLibs.grpc
+    implementation depLibs.lombok
     implementation depLibs.slf4j
-    implementation depLibs.yahooDatasketches
 
-    testCompileOnly depLibs.lombok
-    testImplementation depLibs.junit
-    testAnnotationProcessor depLibs.lombok
+    testImplementation depLibs.mockito
+
+    annotationProcessor depLibs.freebuilder
+    annotationProcessor depLibs.lombok
+}
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            artifactId = 'stream-storage-java-client-base'
+        }
+    }
 }
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle b/stream/clients/java/kv/build.gradle
similarity index 61%
copy from bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
copy to stream/clients/java/kv/build.gradle
index ca9d215..e268ae5 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
+++ b/stream/clients/java/kv/build.gradle
@@ -16,23 +16,21 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-plugins {
-    id 'java'
-}
-
 dependencies {
-    implementation project(":bookkeeper-stats")
-    implementation depLibs.commonsConfiguration
+    implementation project(':bookkeeper-common')
+    implementation project(':stream:api')
+    implementation project(':stream:clients:java:base')
+    implementation project(':stream:common')
+    implementation project(':stream:proto')
+    implementation depLibs.grpc
     implementation depLibs.guava
-    implementation depLibs.jettyServlet
-    implementation depLibs.nettyCommon
-    implementation depLibs.prometheusSimpleClient
-    implementation depLibs.prometheusSimpleClientHotspot
-    implementation depLibs.prometheusSimpleClientServlet
+    implementation depLibs.lombok
+    implementation depLibs.nettyBuffer
+    implementation depLibs.protobuf
     implementation depLibs.slf4j
-    implementation depLibs.yahooDatasketches
 
-    testCompileOnly depLibs.lombok
-    testImplementation depLibs.junit
-    testAnnotationProcessor depLibs.lombok
+    testImplementation project(path: ':stream:clients:java:base', configuration: 'testArtifacts')
+    testImplementation depLibs.mockito
+
+    annotationProcessor depLibs.lombok
 }
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle b/stream/common/build.gradle
similarity index 64%
copy from bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
copy to stream/common/build.gradle
index ca9d215..4b789ca 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
+++ b/stream/common/build.gradle
@@ -16,23 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-plugins {
-    id 'java'
-}
-
 dependencies {
-    implementation project(":bookkeeper-stats")
-    implementation depLibs.commonsConfiguration
+    implementation project(':bookkeeper-common')
+    implementation project(':bookkeeper-stats')
+    implementation depLibs.grpc
     implementation depLibs.guava
-    implementation depLibs.jettyServlet
-    implementation depLibs.nettyCommon
-    implementation depLibs.prometheusSimpleClient
-    implementation depLibs.prometheusSimpleClientHotspot
-    implementation depLibs.prometheusSimpleClientServlet
+    implementation depLibs.jsr305
+    implementation depLibs.lombok
     implementation depLibs.slf4j
-    implementation depLibs.yahooDatasketches
 
-    testCompileOnly depLibs.lombok
-    testImplementation depLibs.junit
+    testImplementation project(':stream:tests-common')
+    testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
+    annotationProcessor depLibs.lombok
     testAnnotationProcessor depLibs.lombok
 }
+
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            artifactId = 'stream-storage-common'
+        }
+    }
+}
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle b/stream/distributedlog/common/build.gradle
similarity index 67%
copy from bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
copy to stream/distributedlog/common/build.gradle
index ca9d215..c2c285d 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
+++ b/stream/distributedlog/common/build.gradle
@@ -16,23 +16,31 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-plugins {
-    id 'java'
-}
-
 dependencies {
+    compileOnly depLibs.lombok
+
+    implementation project(":bookkeeper-common")
     implementation project(":bookkeeper-stats")
+
     implementation depLibs.commonsConfiguration
+    implementation depLibs.commonsLang3
     implementation depLibs.guava
-    implementation depLibs.jettyServlet
-    implementation depLibs.nettyCommon
-    implementation depLibs.prometheusSimpleClient
-    implementation depLibs.prometheusSimpleClientHotspot
-    implementation depLibs.prometheusSimpleClientServlet
+    implementation depLibs.jsr305
+    implementation depLibs.lz4
+    implementation depLibs.nettyBuffer
     implementation depLibs.slf4j
-    implementation depLibs.yahooDatasketches
 
-    testCompileOnly depLibs.lombok
+    testImplementation depLibs.jmock
     testImplementation depLibs.junit
-    testAnnotationProcessor depLibs.lombok
+
+    annotationProcessor depLibs.lombok
+}
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            groupId = 'org.apache.distributedlog'
+            artifactId = 'distributedlog-common'
+        }
+    }
 }
diff --git a/bookkeeper-common/build.gradle b/stream/distributedlog/core/build.gradle
similarity index 51%
copy from bookkeeper-common/build.gradle
copy to stream/distributedlog/core/build.gradle
index d4f3f43..8efe8e0 100644
--- a/bookkeeper-common/build.gradle
+++ b/stream/distributedlog/core/build.gradle
@@ -16,48 +16,40 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-plugins {
-    id 'java-library'
-    id "java-test-fixtures"
-}
-
 dependencies {
-    implementation project(":bookkeeper-stats")
-    implementation project(":cpu-affinity")
-
-    compileOnly depLibs.errorprone
-    compileOnly depLibs.jsr305
-    compileOnly depLibs.lombok
-    compileOnly depLibs.spotbugsAnnotations
+    implementation project(':bookkeeper-common')
+    implementation project(':bookkeeper-server')
+    implementation project(':bookkeeper-stats')
+    implementation project(':stream:distributedlog:common')
+    implementation project(':stream:distributedlog:protocol')
+    implementation depLibs.commonsCli
+    implementation depLibs.commonsCodec
     implementation depLibs.commonsConfiguration
+    implementation depLibs.commonsIO
+    implementation depLibs.commonsLang3
     implementation depLibs.guava
-    implementation depLibs.jacksonAnnotations
-    implementation depLibs.jacksonCore
-    implementation depLibs.jacksonDatabind
-    implementation depLibs.jctools
-    implementation depLibs.nettyCommon
+    implementation depLibs.jsr305
+    implementation depLibs.lombok
+    implementation depLibs.nettyBuffer
+    implementation depLibs.nettyTransportNativeEpoll
     implementation depLibs.slf4j
-    testCompileOnly depLibs.lombok
-    testImplementation depLibs.commonsLang3
-    testImplementation depLibs.hamcrest
+    implementation depLibs.thrift
+    implementation depLibs.zookeeper
+
+    testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
+    testImplementation project(path: ':stream:distributedlog:common', configuration: 'testArtifacts')
     testImplementation depLibs.junit
-    testImplementation depLibs.log4j
     testImplementation depLibs.mockito
-    testImplementation depLibs.slf4jLog4j
 
     annotationProcessor depLibs.lombok
     testAnnotationProcessor depLibs.lombok
 }
 
-configurations {
-    testArtifacts.extendsFrom testRuntime
-}
-
-task testJar(type: Jar) {
-    archiveClassifier.set('test')
-    from sourceSets.test.output
-}
-
-artifacts {
-    testArtifacts testJar
+publishing {
+    publications {
+        maven(MavenPublication) {
+            groupId = 'org.apache.distributedlog'
+            artifactId = 'distributedlog-core'
+        }
+    }
 }
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle b/stream/distributedlog/protocol/build.gradle
similarity index 65%
copy from bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
copy to stream/distributedlog/protocol/build.gradle
index ca9d215..7e93bb3 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/build.gradle
+++ b/stream/distributedlog/protocol/build.gradle
@@ -16,23 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-plugins {
-    id 'java'
-}
-
 dependencies {
-    implementation project(":bookkeeper-stats")
-    implementation depLibs.commonsConfiguration
+    implementation project(':stream:distributedlog:common')
+    implementation depLibs.commonsCodec
     implementation depLibs.guava
-    implementation depLibs.jettyServlet
-    implementation depLibs.nettyCommon
-    implementation depLibs.prometheusSimpleClient
-    implementation depLibs.prometheusSimpleClientHotspot
-    implementation depLibs.prometheusSimpleClientServlet
+    implementation depLibs.jsr305
+    implementation depLibs.lombok
+    implementation depLibs.nettyBuffer
     implementation depLibs.slf4j
-    implementation depLibs.yahooDatasketches
 
-    testCompileOnly depLibs.lombok
+    testImplementation project(':bookkeeper-common')
     testImplementation depLibs.junit
-    testAnnotationProcessor depLibs.lombok
+
+    annotationProcessor depLibs.lombok
+}
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            groupId = 'org.apache.distributedlog'
+            artifactId = 'distributedlog-protocol'
+        }
+    }
 }
diff --git a/build.gradle b/stream/proto/build.gradle
similarity index 60%
copy from build.gradle
copy to stream/proto/build.gradle
index 2e96e6a..cd90529 100644
--- a/build.gradle
+++ b/stream/proto/build.gradle
@@ -16,25 +16,41 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-buildscript {
-    repositories {
-        mavenCentral()
-    }
-}
-
 plugins {
     id 'com.google.protobuf'
-    id 'java'
 }
 
-allprojects {
-    apply from: "$rootDir/dependencies.gradle"
+dependencies {
+    implementation project(':stream:common')
+    implementation depLibs.lombok
+    implementation depLibs.grpc
+    implementation depLibs.commonsLang3
 
-    repositories {
-        mavenCentral()
+    annotationProcessor depLibs.lombok
+}
+
+protobuf {
+    plugins {
+        grpc {
+            artifact = depLibs.protocGenGrpcJava
+        }
+    }
+
+    protoc {
+        artifact = depLibs.protoc
+    }
+
+    generateProtoTasks {
+        all()*.plugins {
+            grpc {}
+        }
     }
 }
 
-pluginManager.withPlugin('java') {
-    sourceCompatibility = targetCompatibility = 8
-}
\ No newline at end of file
+publishing {
+    publications {
+        maven(MavenPublication) {
+            artifactId = 'stream-storage-proto'
+        }
+    }
+}
diff --git a/stream/server/build.gradle b/stream/server/build.gradle
new file mode 100644
index 0000000..8fc3068
--- /dev/null
+++ b/stream/server/build.gradle
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+dependencies {
+    implementation project(':bookkeeper-common')
+    implementation project(':bookkeeper-server')
+    implementation project(':bookkeeper-stats')
+    implementation project(':stream:clients:java:all')
+    implementation project(':stream:clients:java:base')
+    implementation project(':stream:common')
+    implementation project(':stream:distributedlog:core')
+    implementation project(':stream:distributedlog:protocol')
+    implementation project(':stream:proto')
+    implementation project(':stream:statelib')
+    implementation project(':stream:storage:api')
+    implementation project(':stream:storage:impl')
+
+    implementation depLibs.commonsConfiguration
+    implementation depLibs.commonsLang3
+    implementation depLibs.curatorFramework
+    implementation depLibs.grpc
+    implementation depLibs.guava
+    implementation depLibs.jcommander
+    implementation depLibs.lombok
+    implementation depLibs.slf4j
+
+    annotationProcessor depLibs.lombok
+}
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            artifactId = 'stream-storage-server'
+        }
+    }
+}
diff --git a/bookkeeper-common/build.gradle b/stream/statelib/build.gradle
similarity index 50%
copy from bookkeeper-common/build.gradle
copy to stream/statelib/build.gradle
index d4f3f43..6f9c04f 100644
--- a/bookkeeper-common/build.gradle
+++ b/stream/statelib/build.gradle
@@ -17,47 +17,53 @@
  * under the License.
  */
 plugins {
-    id 'java-library'
-    id "java-test-fixtures"
+    id 'com.google.protobuf'
 }
 
 dependencies {
-    implementation project(":bookkeeper-stats")
-    implementation project(":cpu-affinity")
+    implementation project(':bookkeeper-common')
+    implementation project(':stream:api')
+    implementation project(':stream:common')
+    implementation project(':stream:distributedlog:common')
+    implementation project(':stream:distributedlog:core')
+    implementation project(':stream:distributedlog:protocol')
+    implementation project(':stream:proto')
 
-    compileOnly depLibs.errorprone
-    compileOnly depLibs.jsr305
-    compileOnly depLibs.lombok
-    compileOnly depLibs.spotbugsAnnotations
-    implementation depLibs.commonsConfiguration
+    implementation depLibs.commonsLang2
+    implementation depLibs.commonsLang3
     implementation depLibs.guava
-    implementation depLibs.jacksonAnnotations
-    implementation depLibs.jacksonCore
-    implementation depLibs.jacksonDatabind
-    implementation depLibs.jctools
+    implementation depLibs.jsr305
+    implementation depLibs.lombok
+    implementation depLibs.nettyBuffer
     implementation depLibs.nettyCommon
+    implementation depLibs.protobuf
+    implementation depLibs.rocksDb
     implementation depLibs.slf4j
-    testCompileOnly depLibs.lombok
-    testImplementation depLibs.commonsLang3
-    testImplementation depLibs.hamcrest
+
+    testImplementation depLibs.commonsConfiguration
+    testImplementation depLibs.commonsIO
     testImplementation depLibs.junit
-    testImplementation depLibs.log4j
     testImplementation depLibs.mockito
-    testImplementation depLibs.slf4jLog4j
+    testImplementation project(path: ':stream:distributedlog:core', configuration: 'testArtifacts')
 
     annotationProcessor depLibs.lombok
     testAnnotationProcessor depLibs.lombok
 }
 
-configurations {
-    testArtifacts.extendsFrom testRuntime
-}
+protobuf {
+    plugins {
+        grpc {
+            artifact = depLibs.protocGenGrpcJava
+        }
+    }
 
-task testJar(type: Jar) {
-    archiveClassifier.set('test')
-    from sourceSets.test.output
-}
+    protoc {
+        artifact = depLibs.protoc
+    }
 
-artifacts {
-    testArtifacts testJar
+    generateProtoTasks {
+        all()*.plugins {
+            grpc {}
+        }
+    }
 }
diff --git a/bookkeeper-stats/build.gradle b/stream/storage/api/build.gradle
similarity index 74%
copy from bookkeeper-stats/build.gradle
copy to stream/storage/api/build.gradle
index 9507cc8..71cbe41 100644
--- a/bookkeeper-stats/build.gradle
+++ b/stream/storage/api/build.gradle
@@ -16,11 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-plugins {
-    id 'java'
-}
-
 dependencies {
+    implementation project(':bookkeeper-common')
+    implementation project(':stream:common')
+    implementation project(':stream:proto')
     implementation depLibs.commonsConfiguration
-    implementation depLibs.slf4j
+    implementation depLibs.grpc
 }
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            artifactId = 'stream-storage-service-api'
+        }
+    }
+}
+
diff --git a/stream/storage/impl/build.gradle b/stream/storage/impl/build.gradle
new file mode 100644
index 0000000..231abe2
--- /dev/null
+++ b/stream/storage/impl/build.gradle
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+dependencies {
+    implementation project(':bookkeeper-common')
+    implementation project(':bookkeeper-server')
+    implementation project(':bookkeeper-stats')
+    implementation project(':stream:api')
+    implementation project(':stream:clients:java:base')
+    implementation project(':stream:common')
+    implementation project(':stream:distributedlog:core')
+    implementation project(':stream:proto')
+    implementation project(':stream:statelib')
+    implementation project(':stream:storage:api')
+
+    implementation depLibs.commonsCodec
+    implementation depLibs.commonsConfiguration
+    implementation depLibs.commonsLang3
+    implementation depLibs.curatorRecipes
+    implementation depLibs.grpc
+    implementation depLibs.guava
+    implementation depLibs.lombok
+    implementation depLibs.slf4j
+
+    testImplementation project(':stream:distributedlog:common')
+    testImplementation project(':stream:distributedlog:protocol')
+    testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
+    testImplementation project(path: ':stream:clients:java:base', configuration: 'testArtifacts')
+    testImplementation project(path: ':stream:distributedlog:core', configuration: 'testArtifacts')
+    testImplementation depLibs.mockito
+
+    annotationProcessor depLibs.lombok
+    testAnnotationProcessor depLibs.lombok
+}
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            artifactId = 'stream-storage-service-impl'
+        }
+    }
+}
diff --git a/bookkeeper-stats/build.gradle b/stream/tests-common/build.gradle
similarity index 69%
copy from bookkeeper-stats/build.gradle
copy to stream/tests-common/build.gradle
index 9507cc8..f3c33c7 100644
--- a/bookkeeper-stats/build.gradle
+++ b/stream/tests-common/build.gradle
@@ -17,10 +17,31 @@
  * under the License.
  */
 plugins {
-    id 'java'
+    id 'com.google.protobuf'
 }
 
 dependencies {
-    implementation depLibs.commonsConfiguration
+    implementation depLibs.grpc
+    implementation depLibs.lombok
     implementation depLibs.slf4j
+
+    annotationProcessor depLibs.lombok
+}
+
+protobuf {
+    plugins {
+        grpc {
+            artifact = depLibs.protocGenGrpcJava
+        }
+    }
+
+    protoc {
+        artifact = depLibs.protoc
+    }
+
+    generateProtoTasks {
+        all()*.plugins {
+            grpc {}
+        }
+    }
 }