mirror of https://github.com/apache/kafka.git
KAFKA-12415 Prepare for Gradle 7.0 and restrict transitive scope for non api dependencies (#10203)
Gradle 7.0 is required for Java 16 compatibility and it removes a number of deprecated APIs. Fix most issues preventing the upgrade to Gradle 7.0. The remaining ones are more complicated and should be handled in a separate PR. Details of the changes: * Release tarball no longer includes includes test, sources, javadoc and test sources jars (these are still published to the Maven Central repository). * Replace `compile` with `api` or `implementation` - note that `implementation` dependencies appear with `runtime` scope in the pom file so this is a (positive) change in behavior * Add missing dependencies that were uncovered by the usage of `implementation` * Replace `testCompile` with `testImplementation` * Replace `runtime` with `runtimeOnly` and `testRuntime` with `testRuntimeOnly` * Replace `configurations.runtime` with `configurations.runtimeClasspath` * Replace `configurations.testRuntime` with `configurations.testRuntimeClasspath` (except for the usage in the `streams` project as that causes a cyclic dependency error) * Use `java-library` plugin instead of `java` * Use `maven-publish` plugin instead of deprecated `maven` plugin - this changes the commands used to publish and to install locally, but task aliases for `install` and `uploadArchives` were added for backwards compatibility * Removed `-x signArchives` line from the readme since it was wrong (it was a no-op before and it fails now, however) * Replaces `artifacts` block with an approach that works with the `maven-publish` plugin * Don't publish `jmh-benchmark` module - the shadow jar is pretty large and not particularly useful (before this PR, we would publish the non shadow jars) * Replace `version` with `archiveVersion`, `baseName` with `archiveBaseName` and `classifier` with `archiveClassifier` * Update Gradle and plugins to the latest stable version (7.0 is not stable yet) * Use `plugin` DSL to configure plugins * Updated notable changes for 3.0 Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Randall Hauch <rhauch@gmail.com>
This commit is contained in:
parent
96a2b7aac4
commit
7a3ebbebbc
|
@ -46,8 +46,8 @@ def doStreamsArchetype() {
|
||||||
echo 'Verify that Kafka Streams archetype compiles'
|
echo 'Verify that Kafka Streams archetype compiles'
|
||||||
|
|
||||||
sh '''
|
sh '''
|
||||||
./gradlew streams:install clients:install connect:json:install connect:api:install \
|
./gradlew streams:publishToMavenLocal clients:publishToMavenLocal connect:json:publishToMavenLocal connect:api:publishToMavenLocal \
|
||||||
|| { echo 'Could not install kafka-streams.jar (and dependencies) locally`'; exit 1; }
|
|| { echo 'Could not publish kafka-streams.jar (and dependencies) locally to Maven'; exit 1; }
|
||||||
'''
|
'''
|
||||||
|
|
||||||
VERSION = sh(script: 'grep "^version=" gradle.properties | cut -d= -f 2', returnStdout: true).trim()
|
VERSION = sh(script: 'grep "^version=" gradle.properties | cut -d= -f 2', returnStdout: true).trim()
|
||||||
|
|
16
README.md
16
README.md
|
@ -69,10 +69,6 @@ Generate coverage for a single module, i.e.:
|
||||||
### Building a binary release gzipped tar ball ###
|
### Building a binary release gzipped tar ball ###
|
||||||
./gradlew clean releaseTarGz
|
./gradlew clean releaseTarGz
|
||||||
|
|
||||||
The above command will fail if you haven't set up the signing key. To bypass signing the artifact, you can run:
|
|
||||||
|
|
||||||
./gradlew clean releaseTarGz -x signArchives
|
|
||||||
|
|
||||||
The release file can be found inside `./core/build/distributions/`.
|
The release file can be found inside `./core/build/distributions/`.
|
||||||
|
|
||||||
### Building auto generated messages ###
|
### Building auto generated messages ###
|
||||||
|
@ -125,6 +121,12 @@ build directory (`${project_dir}/bin`) clashes with Kafka's scripts directory an
|
||||||
to avoid known issues with this configuration.
|
to avoid known issues with this configuration.
|
||||||
|
|
||||||
### Publishing the jar for all version of Scala and for all projects to maven ###
|
### Publishing the jar for all version of Scala and for all projects to maven ###
|
||||||
|
The recommended command is:
|
||||||
|
|
||||||
|
./gradlewAll publish
|
||||||
|
|
||||||
|
For backwards compatibility, the following also works:
|
||||||
|
|
||||||
./gradlewAll uploadArchives
|
./gradlewAll uploadArchives
|
||||||
|
|
||||||
Please note for this to work you should create/update `${GRADLE_USER_HOME}/gradle.properties` (typically, `~/.gradle/gradle.properties`) and assign the following variables
|
Please note for this to work you should create/update `${GRADLE_USER_HOME}/gradle.properties` (typically, `~/.gradle/gradle.properties`) and assign the following variables
|
||||||
|
@ -167,6 +169,12 @@ Please note for this to work you should create/update user maven settings (typic
|
||||||
|
|
||||||
|
|
||||||
### Installing the jars to the local Maven repository ###
|
### Installing the jars to the local Maven repository ###
|
||||||
|
The recommended command is:
|
||||||
|
|
||||||
|
./gradlewAll publishToMavenLocal
|
||||||
|
|
||||||
|
For backwards compatibility, the following also works:
|
||||||
|
|
||||||
./gradlewAll install
|
./gradlewAll install
|
||||||
|
|
||||||
### Building the test jar ###
|
### Building the test jar ###
|
||||||
|
|
802
build.gradle
802
build.gradle
File diff suppressed because it is too large
Load Diff
|
@ -19,6 +19,14 @@
|
||||||
|
|
||||||
<script id="upgrade-template" type="text/x-handlebars-template">
|
<script id="upgrade-template" type="text/x-handlebars-template">
|
||||||
|
|
||||||
|
<h5><a id="upgrade_300_notable" href="#upgrade_300_notable">Notable changes in 3.0.0</a></h5>
|
||||||
|
<ul>
|
||||||
|
<li>The release tarball no longer includes test, sources, javadoc and test sources jars. These are still published to the Maven Central repository. </li>
|
||||||
|
<li>A number of implementation dependency jars are <a href="https://github.com/apache/kafka/pull/10203">now available in the runtime classpath
|
||||||
|
instead of compile and runtime classpaths</a>. Compilation errors after the upgrade can be fixed by adding the missing dependency jar(s) explicitly
|
||||||
|
or updating the application not to use internal classes.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h5><a id="upgrade_280_notable" href="#upgrade_280_notable">Notable changes in 2.8.0</a></h5>
|
<h5><a id="upgrade_280_notable" href="#upgrade_280_notable">Notable changes in 2.8.0</a></h5>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -61,8 +61,7 @@ versions += [
|
||||||
bcpkix: "1.66",
|
bcpkix: "1.66",
|
||||||
checkstyle: "8.20",
|
checkstyle: "8.20",
|
||||||
commonsCli: "1.4",
|
commonsCli: "1.4",
|
||||||
gradle: "6.8.1",
|
gradle: "6.8.3",
|
||||||
gradleVersionsPlugin: "0.36.0",
|
|
||||||
grgit: "4.1.0",
|
grgit: "4.1.0",
|
||||||
httpclient: "4.5.13",
|
httpclient: "4.5.13",
|
||||||
easymock: "4.2",
|
easymock: "4.2",
|
||||||
|
@ -101,7 +100,6 @@ versions += [
|
||||||
metrics: "2.2.0",
|
metrics: "2.2.0",
|
||||||
mockito: "3.6.0",
|
mockito: "3.6.0",
|
||||||
netty: "4.1.59.Final",
|
netty: "4.1.59.Final",
|
||||||
owaspDepCheckPlugin: "6.0.3",
|
|
||||||
powermock: "2.0.9",
|
powermock: "2.0.9",
|
||||||
reflections: "0.9.12",
|
reflections: "0.9.12",
|
||||||
rocksDB: "5.18.4",
|
rocksDB: "5.18.4",
|
||||||
|
@ -110,14 +108,9 @@ versions += [
|
||||||
scalaJava8Compat : "0.9.1",
|
scalaJava8Compat : "0.9.1",
|
||||||
scalatest: "3.0.8",
|
scalatest: "3.0.8",
|
||||||
scoverage: "1.4.1",
|
scoverage: "1.4.1",
|
||||||
scoveragePlugin: "5.0.0",
|
|
||||||
shadowPlugin: "6.1.0",
|
|
||||||
slf4j: "1.7.30",
|
slf4j: "1.7.30",
|
||||||
snappy: "1.1.8.1",
|
snappy: "1.1.8.1",
|
||||||
spotbugs: "4.1.4",
|
spotbugs: "4.1.4",
|
||||||
spotbugsPlugin: "4.6.0",
|
|
||||||
spotlessPlugin: "5.8.2",
|
|
||||||
testRetryPlugin: "1.2.0",
|
|
||||||
zinc: "1.3.5",
|
zinc: "1.3.5",
|
||||||
zookeeper: "3.5.9",
|
zookeeper: "3.5.9",
|
||||||
zstd: "1.4.8-4"
|
zstd: "1.4.8-4"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -84,7 +84,7 @@ esac
|
||||||
# Loop in case we encounter an error.
|
# Loop in case we encounter an error.
|
||||||
for attempt in 1 2 3; do
|
for attempt in 1 2 3; do
|
||||||
if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
|
if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then
|
||||||
if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v6.8.1/gradle/wrapper/gradle-wrapper.jar"; then
|
if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v6.8.3/gradle/wrapper/gradle-wrapper.jar"; then
|
||||||
rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
|
rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
|
||||||
# Pause for a bit before looping in case the server throttled us.
|
# Pause for a bit before looping in case the server throttled us.
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
|
@ -62,7 +62,7 @@ per second which can increase when you have make your code faster.
|
||||||
|
|
||||||
The JMH benchmarks can be run outside of gradle as you would with any executable jar file:
|
The JMH benchmarks can be run outside of gradle as you would with any executable jar file:
|
||||||
|
|
||||||
java -jar <kafka-repo-dir>/jmh-benchmarks/build/libs/kafka-jmh-benchmarks-all.jar -f2 LRUCacheBenchmark
|
java -jar <kafka-repo-dir>/jmh-benchmarks/build/libs/kafka-jmh-benchmarks-*.jar -f2 LRUCacheBenchmark
|
||||||
|
|
||||||
### Writing benchmarks
|
### Writing benchmarks
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,6 @@ echo "gradle build done"
|
||||||
|
|
||||||
echo "running JMH with args: $@"
|
echo "running JMH with args: $@"
|
||||||
|
|
||||||
java -jar ${libDir}/kafka-jmh-benchmarks-all.jar "$@"
|
java -jar ${libDir}/kafka-jmh-benchmarks-*.jar "$@"
|
||||||
|
|
||||||
echo "JMH benchmarks done"
|
echo "JMH benchmarks done"
|
||||||
|
|
|
@ -631,7 +631,7 @@ with open(os.path.expanduser("~/.gradle/gradle.properties")) as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
if not user_ok("Going to build and upload mvn artifacts based on these settings:\n" + contents + '\nOK (y/n)?: '):
|
if not user_ok("Going to build and upload mvn artifacts based on these settings:\n" + contents + '\nOK (y/n)?: '):
|
||||||
fail("Retry again later")
|
fail("Retry again later")
|
||||||
cmd("Building and uploading archives", "./gradlewAll uploadArchives", cwd=kafka_dir, env=jdk8_env, shell=True)
|
cmd("Building and uploading archives", "./gradlewAll publish", cwd=kafka_dir, env=jdk8_env, shell=True)
|
||||||
cmd("Building and uploading archives", "mvn deploy -Pgpg-signing", cwd=streams_quickstart_dir, env=jdk8_env, shell=True)
|
cmd("Building and uploading archives", "mvn deploy -Pgpg-signing", cwd=streams_quickstart_dir, env=jdk8_env, shell=True)
|
||||||
|
|
||||||
release_notification_props = { 'release_version': release_version,
|
release_notification_props = { 'release_version': release_version,
|
||||||
|
|
Loading…
Reference in New Issue