1. Source Address
Http://archive.apache.org/dist/kafka/0.10.0.0/kafka-0.10.0.0-src.tgz
2. Environment Preparation
Centos
Gradle Download Address Https://services.gradle.org/distributions/gradle-3.1-bin.zip installation please refer here. Note To install version 3.1, you may get an error if you install version 1.1.
Scala
Java
3. Generate Idea Project file
Decompression kafka-0.10.0.0-src.tgz
Go to directory and execute Gradle idea
4. Questions:
Error when executing gradle idea
[Root@bigdata01 kafka-0.10.0.0-src]# gradle idea
starting a gradle Daemon (subsequent builds would be faster)
Buil Ding project ' core ' with the Scala version 2.10.6
Failure:build failed with an exception.
* Where:
Build file '/opt/bigdata/kafka/kafka-0.10.0.0-src/build.gradle ' line:230
* What went wrong:
A Problem occurred evaluating root project ' KAFKA-0.10.0.0-SRC '.
> Failed to apply plugin [class ' Org.gradle.api.plugins.scala.ScalaBasePlugin ']
> No such property:useant for C Lass:org.gradle.api.tasks.scala.ScalaCompileOptions
* Try:
Run with--STACKTRACE option to get the stack trace . Run with--info or--debug option to get more log output.
BUILD FAILED Total
time:22.997 secs
Workaround: Vim kafka-0.10.0.0-src/build.gradle file
Add as Downstream
ScalaCompileOptions.metaClass.daemonServer = True
ScalaCompileOptions.metaClass.fork = True
ScalaCompileOptions.metaClass.useAnt = False
ScalaCompileOptions.metaClass.useCompileDaemon = False
Error when executing gradle idea
Failure:build failed with an exception.
* Where:
Build file '/opt/bigdata/kafka/kafka-0.10.0.0-src/build.gradle ' line:48
* What went wrong:
Could Not compile build file '/opt/bigdata/kafka/kafka-0.10.0.0-src/build.gradle '.
> Startup failed:
build file '/opt/bigdata/kafka/kafka-0.10.0.0-src/build.gradle ': 48:unable to resolve class Componentselection
@ Line, column.
Rules.all {componentselection selection
^
1 Error
* Try: Run with
--stacktrace option to get the Stack trace. Run with--info or--debug option to get more log output.
BUILD FAILED Total
time:9.076 secs
I previously installed the 1.1 version of Gradle. After switching to version 3.1, the problem is resolved.