赞
踩
1.java环境
检查java版本,1.8
java -version
2.scala环境
检查scala版本,2.11.8
scala -version
3.gradle环境
检查gradle版本
gradle -version
gradle各版本下载地址
gradle依赖
johnrengelman.shadow插件版本
4.kafka
这里下载0.11.3,gradle版本也要选择低版本,4.10.2可以编译成功,5.6,6.8都编译失败
解压kafka-0.11.0.3-src.tgz
F:\resources>cd kafka-0.11.0.3-src
F:\resources\kafka-0.11.0.3-src>gradle idea
F:\resources\kafka-0.11.0.3-src>gradle idea FAILURE: Build failed with an exception. * Where: Build file 'F:\resources\kafka-0.11.0.3-src\build.gradle' line: 140 * What went wrong: A problem occurred evaluating root project 'kafka-0.11.0.3-src'. > Plugin with id 'findbugs' not found. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 1s
提示kafka-0.11.0.3-src目录下build.gradle的140行,findbugs有问题
当前是6.8版本,更改版本为5.6
重新gradle idea
Starting a Gradle Daemon (subsequent builds will be faster) > Configure project : Building project 'core' with Scala version 2.11.11 FAILURE: Build failed with an exception. * Where: Build file 'F:\resources\kafka-0.11.0.3-src\build.gradle' line: 504 * What went wrong: A problem occurred evaluating root project 'kafka-0.11.0.3-src'. > Failed to apply plugin [id 'org.scoverage'] > Could not create an instance of type org.scoverage.ScoverageExtension. > You can't map a property that does not exist: propertyName=testClassesDir * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.6/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 25s
提示504行org.scoverage
把 build.gradle 文件29行
classpath 'org.scoverage:gradle-scoverage:2.1.0'
2.1.0修改为2.5.0,再次执行gradle idea
> Configure project : Building project 'core' with Scala version 2.11.11 FAILURE: Build failed with an exception. * Where: Build file 'F:\resources\kafka-0.11.0.3-src\build.gradle' line: 950 * What went wrong: A problem occurred evaluating root project 'kafka-0.11.0.3-src'. > org.gradle.api.internal.java.JavaLibrary.<init>(Lorg/gradle/api/artifacts/PublishArtifact;Lorg/gradle/api/artifacts/DependencySet;)V * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.6/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 6s
再次降低gradle版本,由5.6改为4.10.2,gradle-scoverage:2.5.0修改回来2.1.0
再次执行gradle idea
> Configure project :
Building project 'core' with Scala version 2.11.11
> Task :idea
Generated IDEA project at file:///F:/resources/kafka-0.11.0.3-src/kafka-0.11.0.3-src.ipr
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 7s
21 actionable tasks: 21 executed
1.File–setting里面设置gradle
2.File–setting–plugin,安装scala插件
3.File–open ,打开kafka源码目录kafka-0.11.0.3-src
目录 | 说明 |
---|---|
bin | 启动脚本,启停KafkaServer,创建主题等 |
checkstyle | 代码检查配置 |
clients | 生产者和消费者代码,新版java语言开发 |
config | 运行相关配置 |
connect | Kafka Connect运用用户快速定义并实现各种Connector(File,Jdbc,Hdfs等),大批量数据导入导出方便 |
core | kafka服务实例的代码,scala语言开发,实现了集群管理,分区副本管理,消息存储和消息获取,网络通信等功能 |
docs | 文档 |
examples | 使用生产者消费者demo |
gradle | gradle构建相关 |
streams | kafka 流相关,替代storm等 |
tests | 测试脚本 |
tools | 工具类,查看生产者性能等 |
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。