kafka源码导入IDEA,用gradle idea转换失败!世界未解之谜

问题:gradle idea执行出错!无法转换kafka源码为IDEA格式

Build file ‘D:\kafka-0.10.0.1-src\kafka-0.10.0.1-src\build.gradle’ line: 288

A problem occurred evaluating root project ‘kafka-0.10.0.1-src’.

Cannot set the value of read-only property ‘additionalSourceDirs’ for task ‘:jacocoRootReport’ of type org.gradle.testing.jacoco.tasks.JacocoReport.

解决方法

思考了一下,Kafka源码打包的时候用的肯定是当时对应的Gradle版本!So
选用源码里build.gradle文件了的gradleVersion对应的版本即可!

kafka 0.10.0.1版本对应的是gradle2.13 版本
执行gradle idea成功!


```bash
D:\>cd D:\kafka-0.10.0.1-src\kafka-0.10.0.1-src

D:\kafka-0.10.0.1-src\kafka-0.10.0.1-src>gradle idea
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.13/userguide/gradle_daemon.html.
Building project 'core' with Scala version 2.10.6
Build file 'D:\kafka-0.10.0.1-src\kafka-0.10.0.1-src\build.gradle': line 233
useAnt has been deprecated and is scheduled to be removed in Gradle 3.0. The Ant-Based Scala compiler is deprecated, please see 
......
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.6.3/jackson-core-2.6.3.jar
Download https://repo1.maven.org/maven2/org/rocksdb/rocksdbjni/4.8.0/rocksdbjni-4.8.0-sources.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.6.3/jackson-databind-2.6.3-sources.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.6.0/jackson-annotations-2.6.0-sources.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.6.3/jackson-core-2.6.3-sources.jar
:streams:idea
:tools:ideaModule
Download https://repo1.maven.org/maven2/net/sourceforge/argparse4j/argparse4j/0.5.0/argparse4j-0.5.0.pom
......
Download https://repo1.maven.org/maven2/org/glassfish/hk2/external/aopalliance-repackaged/2.4.0-b34/aopalliance-repackaged-2.4.0-b34-sources.jar
:connect:runtime:idea
:streams:examples:ideaModule
:streams:examples:idea

BUILD SUCCESSFUL

Total time: 40 mins 23.427 secs

机智如我!哈哈哈

最后,会产生所需文件,如下:
在这里插入图片描述

But问题二又来了!IDEA版本不兼容

The project uses Gradle 2.13 which is incompatible with IDEA running on Java 10 or newer.
See details at https://github.com/gradle/gradle/issues/8431
Possible solution:

  • Upgrade Gradle wrapper to 4.8.1 version and re-import the project

说这高贵的IDEA现在是用Jdk10或更高版本,看不起我们JDK1.8,所以你这gradle用1.8不行,我们不兼容!呵呵!

然后,有个大神公布了下一步的办法:

用IDEA的Choose Runtime插件,生成IDEA对应的JDK1.8环境

https://blog.csdn.net/jiajane/article/details/103014036

你可能感兴趣的:(开发,Kafka,kafka)