kafka 0.11.0.3 源码编译

Posted johnny666888

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kafka 0.11.0.3 源码编译相关的知识,希望对你有一定的参考价值。

首先下载 kafka 0.11.0.3 版本 源码:

http://mirrors.hust.edu.cn/apache/kafka/0.11.0.3/ 下载源码

首先安装 gradle,不再说明

1. 解压缩source压缩包:

2. 进入项目根目录下,执行 gradle

3. 转换为 idea 项目 gradlew idea

技术图片

 

gradle过程遇到的问题:

问题一: jcenter 连接不上问题

问题描述:

* What went wrong:
A problem occurred configuring root project ‘kafka-0.11.0.3-src‘.
> Could not resolve all artifacts for configuration ‘:classpath‘.
   > Could not download grgit.jar (org.ajoberstar:grgit:1.9.2)
      > Could not get resource ‘https://jcenter.bintray.com/org/ajoberstar/grgit/1.9.2/grgit-1.9.2.jar‘.
         > Could not GET ‘https://d29vzk4ow07wi7.cloudfront.net/f36e735ef1f4e96295598c227cc956443518ceccc9ad4ff5d587509561e7f686?response-content-disposition=attachment%3Bfilename%3D%22grgit-1.9.2.jar%22&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHAqOi8vZDI5dnprNG93MDd3aTcuY2xvdWRmcm9udC5uZXQvZjM2ZTczNWVmMWY0ZTk2Mjk1NTk4YzIyN2NjOTU2NDQzNTE4Y2VjY2M5YWQ0ZmY1ZDU4NzUwOTU2MWU3ZjY4Nj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPWF0dGFjaG1lbnQlM0JmaWxlbmFtZSUzRCUyMmdyZ2l0LTEuOS4yLmphciUyMiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTU2MTIyMTY5NH0sIklwQWRkcmVzcyI6eyJBV1M6U291cmNlSXAiOiIwLjAuMC4wLzAifX19XX0_&Signature=pidSiToQYGZR~mEpr4CdBhcIiFEbsOlmAqY7U6hBYXiklHUkqjSK9Ow0vmc84YF67SPQcZ~YythyH~yUCGgNcFVC~MeFfhTpHqvYUFpggzyTNFibLPe37R4pm5B0DLvZaH-ERhGiKzuKXAPqNLU6mNDyxukc2XzfsHmCLywSMl-ZtGWAHfOpVJgf3FUgKQ5YfCZEnV5IGdJ~sXbZdCSGAlIQadQagPx63anyfm-OnUvABKspEYCr4Q6O9xX9SRMpRRNSJdMDIv0yrVz~07Dcw5qTCr~EmeN59C6ah5yzHA7XAA15vCvYYV9vDb9I0a-mKtRZfMEMqHy2YyFbpM8Vgw__&Key-Pair-Id=APKAIFKFWOMXM2UMTSFA‘.
            > Connect to d29vzk4ow07wi7.cloudfront.net:443 [d29vzk4ow07wi7.cloudfront.net/99.86.134.84, d29vzk4ow07wi7.cloudfront.net/99.86.134.156, d29vzk4ow07wi7.cloudfront.net/99.86.134.138, d29vzk4ow07wi7.cloudfront.net/99.86.134.77] failed: connect timed out
   > Could not download shadow.jar (com.github.jengelman.gradle.plugins:shadow:1.2.4)
      > Could not get resource ‘https://jcenter.bintray.com/com/github/jengelman/gradle/plugins/shadow/1.2.4/shadow-1.2.4.jar‘.
         > Could not GET ‘https://d29vzk4ow07wi7.cloudfront.net/3dd5f139b9b224448ec7fead00e3dafc229934522fd2d5bae4d658a1a2656139?response-content-disposition=attachment%3Bfilename%3D%22shadow-1.2.4.jar%22&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHAqOi8vZDI5dnprNG93MDd3aTcuY2xvdWRmcm9udC5uZXQvM2RkNWYxMzliOWIyMjQ0NDhlYzdmZWFkMDBlM2RhZmMyMjk5MzQ1MjJmZDJkNWJhZTRkNjU4YTFhMjY1NjEzOT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPWF0dGFjaG1lbnQlM0JmaWxlbmFtZSUzRCUyMnNoYWRvdy0xLjIuNC5qYXIlMjIiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE1NjEyMjE2Mzl9LCJJcEFkZHJlc3MiOnsiQVdTOlNvdXJjZUlwIjoiMC4wLjAuMC8wIn19fV19&Signature=SMAMfkHQ023AjbvODL8h64ZgDMAaIwaruPN0ryL3qeo8NxZjN1FdkiIsjfEh1U~4cdoMDAJUwVuM-9NYdDIjpaRbNt1PJ1rM-0W-vxgRYUo3V5xJTDXUhCVyN60PW~TzYA17na3gfZYFfi~nsd3hmSmj4Wvr7rssvacZoFa0Ptd~66YiSiLAx~TzgPfuYTi1otP~Ef6m9tlwKI5y10r-BpI2g--FnWcqv2lAXowrZwkY~Dd9JxmP~aWKftHqW61qolv1KRnmX5QznPifaJ1U2VNXy1TwibQidIqseRuWsvC~J446Qtqduhdll0aGkm6-MgmW-tGYaShO2eDW0vocUQ__&Key-Pair-Id=APKAIFKFWOMXM2UMTSFA‘.
            > Connect to d29vzk4ow07wi7.cloudfront.net:443 [d29vzk4ow07wi7.cloudfront.net/99.86.134.156, d29vzk4ow07wi7.cloudfront.net/99.86.134.84, d29vzk4ow07wi7.cloudfront.net/99.86.134.138, d29vzk4ow07wi7.cloudfront.net/99.86.134.77] failed: connect timed out
* 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
BUILD FAILED in 6m 58s 

解决方案:

在 build.gradle 文件中作如下修改:
在 jcenter 的上面加上 aliyun maven center:
maven url http://maven.aliyun.com/nexus/content/groups/public/
jcenter()

 

问题二: gradle 5.0 与旧版本不兼容问题

 

 

(base) JohnnyBaideMacBook-Pro:kafka-0.11.0.3-src johnnybai$ gradle --stacktrace
 
> Configure project :
Building project ‘core‘ with Scala version 2.11.11
 
FAILURE: Build failed with an exception.
 
* Where:
Build file ‘/Users/johnnybai/local/kafka-0.11.0.3-src/build.gradle‘ line: 505
 
* 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_Decorated.
      > You can‘t map a property that does not exist: propertyName=testClassesDir
 
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
 
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project ‘kafka-0.11.0.3-src‘.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:206)
        at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:211)
        at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:66)
        at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:63)
        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
        at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:63)
        at org.gradle.configuration.project.BuildScriptProcessor$1.run(BuildScriptProcessor.java:44)
        at org.gradle.internal.Factories$1.create(Factories.java:25)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:200)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:41)
        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject$1.run(LifecycleProjectEvaluator.java:107)
        at org.gradle.internal.Factories$1.create(Factories.java:25)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
        at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withProjectLock(DefaultProjectStateRegistry.java:226)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:220)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186)
        at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:96)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:68)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:687)
        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:140)
        at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:60)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:41)
        at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:286)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:194)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150)
        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:133)
        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:79)
        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:76)
        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:103)
        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:96)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
        at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:96)
        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:76)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.run(RunAsBuildOperationBuildActionRunner.java:49)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:44)
        at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:79)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:44)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:62)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:34)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:46)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id ‘org.scoverage‘]
        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:160)
        at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:130)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:120)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:38)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:86)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:143)
        at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:46)
        at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:479)
        at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:191)
        at org.gradle.internal.metaobject.CompositeDynamicObject.tryInvokeMethod(CompositeDynamicObject.java:98)
        at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.tryInvokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:30)
        at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:57)
        at build_738klan4r2fuo79emjap0iv6t$_run_closure31.doCall(/Users/johnnybai/local/kafka-0.11.0.3-src/build.gradle:505)
        at org.gradle.util.ClosureBackedAction.execute(ClosureBackedAction.java:70)
        at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:154)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:105)
        at org.gradle.util.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:166)
        at org.gradle.api.internal.DefaultMutationGuard$2.execute(DefaultMutationGuard.java:41)
        at org.gradle.internal.Actions.with(Actions.java:245)
        at org.gradle.api.internal.project.BuildOperationCrossProjectConfigurator$3.run(BuildOperationCrossProjectConfigurator.java:90)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.project.BuildOperationCrossProjectConfigurator.runProjectConfigureAction(BuildOperationCrossProjectConfigurator.java:87)
        at org.gradle.api.internal.project.BuildOperationCrossProjectConfigurator.access$500(BuildOperationCrossProjectConfigurator.java:32)
        at org.gradle.api.internal.project.BuildOperationCrossProjectConfigurator$2.run(BuildOperationCrossProjectConfigurator.java:81)
        at org.gradle.internal.Factories$1.create(Factories.java:25)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:200)
        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186)
        at org.gradle.api.internal.project.BuildOperationCrossProjectConfigurator.runProjectConfigureActionWithMutationLock(BuildOperationCrossProjectConfigurator.java:78)
        at org.gradle.api.internal.project.BuildOperationCrossProjectConfigurator.project(BuildOperationCrossProjectConfigurator.java:43)
        at org.gradle.api.internal.project.DefaultProject.project(DefaultProject.java:1149)
        at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:479)
        at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:191)
        at org.gradle.internal.metaobject.CompositeDynamicObject.tryInvokeMethod(CompositeDynamicObject.java:98)
        at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.tryInvokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:30)
        at org.gradle.groovy.scripts.BasicScript$ScriptDynamicObject.tryInvokeMethod(BasicScript.java:133)
        at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:160)
        at org.gradle.groovy.scripts.BasicScript.invokeMethod(BasicScript.java:82)
        at build_738klan4r2fuo79emjap0iv6t.run(/Users/johnnybai/local/kafka-0.11.0.3-src/build.gradle:501)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
        ... 115 more
Caused by: org.gradle.api.reflect.ObjectInstantiationException: Could not create an instance of type org.scoverage.ScoverageExtension_Decorated.
        at org.gradle.internal.reflect.DirectInstantiator.newInstance(DirectInstantiator.java:53)
        at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
        at org.gradle.api.internal.plugins.DefaultConvention.instantiate(DefaultConvention.java:242)
        at org.gradle.api.internal.plugins.DefaultConvention.create(DefaultConvention.java:142)
        at org.scoverage.ScoveragePlugin.apply(ScoveragePlugin.groovy:18)
        at org.scoverage.ScoveragePlugin.apply(ScoveragePlugin.groovy)
        at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42)
        at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:50)
        at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:174)
        at org.gradle.api.internal.plugins.DefaultPluginManager.access$300(DefaultPluginManager.java:50)
        at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:264)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:152)
        at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:149)
        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:149)
        ... 157 more
Caused by: org.gradle.api.InvalidUserDataException: You can‘t map a property that does not exist: propertyName=testClassesDir
        at org.gradle.api.internal.ConventionAwareHelper.map(ConventionAwareHelper.java:56)
        at org.gradle.api.internal.ConventionAwareHelper.map(ConventionAwareHelper.java:80)
        at org.gradle.api.internal.ConventionMapping$map.call(Unknown Source)
        at org.scoverage.ScoverageExtension$_closure6.doCall(ScoverageExtension.groovy:89)
        at org.gradle.util.ClosureBackedAction.execute(ClosureBackedAction.java:70)
        at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:154)
        at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:130)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:575)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:91)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:103)
        at org.gradle.util.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:166)
        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:352)
        at org.gradle.api.internal.tasks.DefaultTaskContainer_Decorated.create(Unknown Source)
        at org.gradle.api.internal.tasks.DefaultTaskContainer_Decorated$create.call(Unknown Source)
        at org.scoverage.ScoverageExtension.<init>(ScoverageExtension.groovy:88)
        at org.scoverage.ScoverageExtension_Decorated.<init>(Unknown Source)
        at org.gradle.internal.reflect.DirectInstantiator.newInstance(DirectInstantiator.java:51)
        ... 176 more
 
 
* 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.0/userguide/command_line_interface.html#sec:command_line_warnings
 
BUILD FAILED in 0s

 

 

解决方案:

升级依赖包参照 KAFKA-7706 的 patch:

https://issues.apache.org/jira/secure/attachment/12950666/0001-fix-bug-build-fails-wiht-gradle-5.0.patch
// classpath ‘org.scoverage:gradle-scoverage:2.1.0‘ classpath ‘org.scoverage:gradle-scoverage:2.5.0‘ classpath ‘com.github.jengelman.gradle.plugins:shadow:2.0.1‘

 

 

 

 

 

以上是关于kafka 0.11.0.3 源码编译的主要内容,如果未能解决你的问题,请参考以下文章

聊聊 Kafka:编译 Kafka 源码并搭建源码环境

在Windows环境IDEA下Kafka源码编译

idea 编译 kafka 源码

Idea下Kafka源码阅读编译环境搭建

Kafka 1.1.1 源码编译

Kafka 0.10.1版本源码 Idea编译