windows下使用 intellij idea 編譯 kafka 源碼環(huán)境
1. 從 GitHub 網(wǎng)站,git clone kafka 源碼
2. 下載安裝好 gradle,scala
2.1 從 dependencies.gradle 文件中找到 gradle 的版本,然后下載指定版本,并配置好 GRADLE_HOME 環(huán)境變量
3. 進(jìn)入 kafka 項(xiàng)目目錄,依次執(zhí)行 gradle wrapper,gradle idea,gradle build --exclude-task test
4. 將工程導(dǎo)入到 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'),修改對應(yīng)的 log4j 依賴,然后重新執(zhí)行 gradle idea,重新導(dǎo)入 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'
}
}
目標(biāo)就是把下圖的 log4j 依賴配置好。


到此這篇關(guān)于windows下使用 intellij idea 編譯 kafka 源碼環(huán)境的文章就介紹到這了,更多相關(guān) idea 編譯 kafka 源碼內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
SpringBoot使用mybatis-plus分頁查詢無效的問題解決
MyBatis-Plus提供了很多便捷的功能,包括分頁查詢,本文主要介紹了SpringBoot使用mybatis-plus分頁查詢無效的問題解決,具有一定的參考價值,感興趣的可以了解一下2023-12-12
關(guān)于SpringBoot整合redis使用Lettuce客戶端超時問題
使用到Lettuce連接redis,一段時間后不操作,再去操作redis,會報連接超時錯誤,在其重連后又可使用,糾結(jié)是什么原因?qū)е碌哪兀旅嫘【幗o大家?guī)砹薙pringBoot整合redis使用Lettuce客戶端超時問題及解決方案,一起看看吧2021-08-08
Eclipse下基于Java的OpenCV開發(fā)環(huán)境配置教程
這篇文章主要為大家詳細(xì)介紹了Eclipse下基于Java的OpenCV開發(fā)環(huán)境配置教程,具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-07-07

