airbnb / kafka-statsd-metrics2

Send Kafka Metrics to StatsD.
Apache License 2.0
135 stars 49 forks source link

Fix gradle build #35

Closed edmundmok closed 4 years ago

edmundmok commented 4 years ago

The existing build script uses outdated gradle versions and dependencies, and no longer works when trying to build the project.

The oudated gradle version leads to the following error:

* What went wrong:
A problem occurred configuring root project 'kafka-statsd-metrics2'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.github.jengelman.gradle.plugins:shadow:0.9.0-M3.
     Required by:
         :kafka-statsd-metrics2:0.5.2
      > Could not HEAD 'http://jcenter.bintray.com/com/github/jengelman/gradle/plugins/shadow/0.9.0-M3/shadow-0.9.0-M3.pom'. Received status code 403 from server: Forbidden

This is likely due to older gradle versions not using https and recently JCenter only supports HTTPS. Updating the gradle version fixes this issue.

The existing shadow plugin dependency also leads to the following error:

* What went wrong:
A problem occurred evaluating root project 'kafka-statsd-metrics2'.
> com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: com/github/jengelman/gradle/plugins/shadow/ShadowPlugin$ShadowJavaLibrary

This is fixed by using a newer version of shadow.

Finally, the way to exclude dependencies in the shadowJar task has been updated, which caused this error:

* What went wrong:
A problem occurred evaluating root project 'kafka-statsd-metrics2'.
> Could not find method dependency() for arguments [org.apache.kafka:kafka_2.10:0.9.0.1] on task ':shadowJar' of type com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar.
parasitew commented 4 years ago

@xuzha we don't have write access to this repo, can you merge this PR and add us to airbnb organization?