windows下使用 intellij idea 编译 kafka 源码环境
1. 从 GitHub 网站,git clone kafka 源码
2. 下载安装好 gradle,scala
2.1 从 dependencies.gradle 文件中找到 gradle 的版本,然后下载指定版本,并配置好 GRADLE_HOME 环境变量
3. 进入 kafka 项目目录,依次执行 gradle wrapper,gradle idea,gradle build --exclude-task test
4. 将工程导入到 idea
4.1 启动主类 kafka.Kafka
4.2 program arguments:config/server.properties
4.3 把 config 目录下的 log4j.properties 拷贝到 core/src/main/resources 目录
4.4 File -> Project Structure -> Modules
5. 启动程序
然而,大部分情况下,日志不会打印出来,配置一下 core 模块的 log4j 依赖
找到 build.gradle 文件中的 project(':core'),修改对应的 log4j 依赖,然后重新执行 gradle idea,重新导入 idea 中
project(':core') { println "Building project 'core' with Scala version ${versions.scala}" apply plugin: 'scala' // scaladoc generation is configured at the sub-module level with an artifacts // block (cf. see streams-scala). If scaladoc generation is invoked explicitly // for the `core` module, this ensures the generated jar doesn't include scaladoc // files since the `core` module doesn't include public APIs. scaladoc { enabled = false } if (userEnableTestCoverage) apply plugin: "org.scoverage" archivesBaseName = "kafka_${versions.baseScala}" dependencies { compile project(':clients') compile project(':metadata') compile project(':raft') compile libs.argparse4j compile libs.jacksonDatabind compile libs.jacksonModuleScala compile libs.jacksonDataformatCsv compile libs.jacksonJDK8Datatypes compile libs.joptSimple compile libs.metrics compile libs.scalaCollectionCompat compile libs.scalaJava8Compat compile libs.scalaLibrary // only needed transitively, but set it explicitly to ensure it has the same version as scala-library compile libs.scalaReflect compile libs.scalaLogging compile libs.slf4jApi compile libs.slf4jlog4j compile libs.log4j compile(libs.zookeeper) { // exclude module: 'slf4j-log4j12' // exclude module: 'log4j' } // ZooKeeperMain depends on commons-cli but declares the dependency as `provided` compile libs.commonsCli compileOnly libs.log4j testCompile project(':clients').sourceSets.test.output testCompile libs.bcpkix testCompile libs.mockitoCore testCompile libs.easymock testCompile(libs.apacheda) { exclude group: 'xml-apis', module: 'xml-apis' // `mina-core` is a transitive dependency for `apacheds` and `apacheda`. // It is safer to use from `apacheds` since that is the implementation. exclude module: 'mina-core' } testCompile libs.apachedsCoreApi testCompile libs.apachedsInterceptorKerberos testCompile libs.apachedsProtocolShared testCompile libs.apachedsProtocolKerberos testCompile libs.apachedsProtocolLdap testCompile libs.apachedsLdifPartition testCompile libs.apachedsMavibotPartition testCompile libs.apachedsJdbmPartition testCompile libs.junitJupiter testCompile libs.slf4jlog4j testCompile(libs.jfreechart) { exclude group: 'junit', module: 'junit' } }
目标就是把下图的 log4j 依赖配置好。
到此这篇关于windows下使用 intellij idea 编译 kafka 源码环境的文章就介绍到这了,更多相关 idea 编译 kafka 源码内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
Spring Boot的Maven插件Spring Boot Maven plu
Spring Boot的Maven插件Spring Boot Maven plugin以Maven的方式提供Spring Boot支持,Spring Boot Maven plugin将Spring Boot应用打包为可执行的jar或war文件,然后以通常的方式运行Spring Boot应用,本文介绍Spring Boot的Maven插件Spring Boot Maven plugin,一起看看吧2024-01-01Java并发之原子性 有序性 可见性及Happen Before原则
一提到happens-before原则,就让人有点“丈二和尚摸不着头脑”。这个涵盖了整个JMM中可见性原则的规则,究竟如何理解,把我个人一些理解记录下来。下面可以和小编一起学习Java 并发四个原则2021-09-09POI XSSFSheet shiftRows bug问题解决
这篇文章主要介绍了POI XSSFSheet shiftRows bug问题解决,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪2023-07-07Hibernate中使用HQLQuery查询全部数据和部分数据的方法实例
今天小编就为大家分享一篇关于Hibernate中使用HQLQuery查询全部数据和部分数据的方法实例,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧2019-03-03Spring Native实现0.059s启动一个SpringBoot项目
Spring Native是Spring框架的一个子项目,旨在提供一种将Spring应用程序编译为本地可执行文件的方法,从而提高启动时间和资源效率,本文主要介绍了Spring Native实现0.059s启动一个SpringBoot项目,感兴趣的可以了解一下2024-02-02
最新评论