龙空技术网

Kafka2.7.0源码编译导入idea/eclipse调试

大数据从业者FelixZh 252

前言:

眼前咱们对“idea导入css”大致比较关怀,看官们都需要学习一些“idea导入css”的相关文章。那么小编也在网上收集了一些对于“idea导入css””的相关文章,希望咱们能喜欢,同学们快快来学习一下吧!

前言概述

kafka2.7.0是当前最新最稳定的版本,发布于2020年12月21日。笔者今天体验一把,梳理一下如何对kafka源码进行编译打包以用于安装部署,如何编译导入IDE(idea和eclipse)以方便源码的阅读学习调试。另外提一句,kafka官网不知道从哪个版本对页面布局有些许调整,不过内容结构基本没变化。

准备环境

$java -versionjavaversion "1.8.0_172"Java(TM)SE Runtime Environment (build 1.8.0_172-b11)JavaHotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
$scala -versionScala code runnerversion 2.13.3 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc.
$gradle -version------------------------------------------------------------Gradle6.6------------------------------------------------------------

注意:gradle版本不对,可能会遇到异常

Could not findmethod scala() for arguments[build_2ofsm9wzcvhxxkvqblsz8ogy5$_run_closure5$_closure73$_closure105@729633ff]on object of type org.gradle.api.plugins.scala.ScalaPlugin. 

下载kafka2.7.0源码

$git clone -b 2.7.0 git@github.com:apache/kafka.gitCloninginto 'kafka'...remote:Enumerating objects: 247892, done.remote:Total 247892 (delta 0), reused 0 (delta 0), pack-reused 247892Receivingobjects: 100% (247892/247892), 115.37 MiB | 3.02 MiB/s, done.Resolvingdeltas: 100% (119346/119346), done.Note:checking out '448719dc99a19793d55aaaa8b64282ed3fb3197d'.Checking out files:100% (3898/3898), done.

执行如下命令编译打包

$ cd kafka$ gradle cleanreleaseTarGz

编译成功,安装包会生成如下目录

$ls core/build/distributions/kafka_2.13-2.7.0.tgzcore/build/distributions/kafka_2.13-2.7.0.tgz

执行如下命令编译,导入idea

$gradle idea> Configure project :Buildingproject 'core' with Scala version 2.13.3Buildingproject 'streams-scala' with Scala version 2.13.3 > Task :ideaGeneratedIDEA project at  DeprecatedGradle features were used in this build, making it incompatible with Gradle7.0.Use'--warning-mode all' to show the individual deprecation warnings.See BUILD SUCCESSFUL in 15s38actionable tasks: 38 executed

执行如下命令编译,导入eclipse

$gradle eclipse > Configure project :Buildingproject 'core' with Scala version 2.13.3Buildingproject 'streams-scala' with Scala version 2.13.3 DeprecatedGradle features were used in this build, making it incompatible with Gradle7.0.Use'--warning-mode all' to show the individual deprecation warnings.See BUILD SUCCESSFUL in 9s99actionable tasks: 99 executed

执行如下命令编译doc

$ gradle aggregatedJavadoc$ gradle Javadoc$ gradle javadocJar$ gradle scaladoc$ gradle scaladocJar$ gradle docsJar

标签: #idea导入css