首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

kafka源码编译

前言

github网站kafka项目的README.md有关于kafka源码编译的说明,如下:

不感兴趣的可以直接跳过,看图操作即可

github地址:https://github.com/apache/kafka

Apache Kafka

See our web site for details on the project.

You need to have Gradle and Java installed.

Kafka requires Gradle 4.7 or higher.

Java 8 should be used for building in order to support both Java 8 and Java 11 at runtime.

Scala 2.12 is used by default, see below for how to use a different Scala version or all of the supported Scala versions.

First bootstrap and download the wrapper

Now everything else will work.

Build a jar and run it

Build source jar

Build aggregated javadoc

Build javadoc and scaladoc

Run unit/integration tests

Force re-running tests without code change

Running a particular unit/integration test

Running a particular test method within a unit/integration test

Running a particular unit/integration test with log4j output

Change the log4j setting in either or

Generating test coverage reports

Generate coverage reports for the whole project:

Generate coverage for a single module, i.e.:

Building a binary release gzipped tar ball

The above command will fail if you haven't set up the signing key. To bypass signing the artifact, you can run:

The release file can be found inside .

Cleaning the build

Running a task with a particular version of Scala (either 2.11.x or 2.12.x)

Note that if building the jars with a version other than 2.12.x, you need to set the variable or change it in to run the quick start.

You can pass either the major version (eg 2.12) or the full version (eg 2.12.7):

Running a task with all scala versions

Append to the task name:

Running a task for a specific project

This is for , and

Listing all gradle tasks

Building IDE project

Note that this is not strictly necessary (IntelliJ IDEA has good built-in support for Gradle projects, for example).

The task has been configured to use as Eclipse's build directory. Eclipse's default build directory () clashes with Kafka's scripts directory and we don't use Gradle's build directory to avoid known issues with this configuration.

Publishing the jar for all version of Scala and for all projects to maven

Please note for this to work you should create/update (typically, ) and assign the following variables

Publishing the streams quickstart archetype artifact to maven

For the Streams archetype project, one cannot use gradle to upload to maven; instead the command needs to be called at the quickstart folder:

Please note for this to work you should create/update user maven settings (typically, ) to assign the following variables

Installing the jars to the local Maven repository

Building the test jar

Determining how transitive dependencies are added

Determining if any dependencies could be updated

Running code quality checks

There are two code quality analysis tools that we regularly run, spotbugs and checkstyle.

Checkstyle

Checkstyle enforces a consistent coding style in Kafka. You can run checkstyle using:

The checkstyle warnings will be found in and files in the subproject build directories. They are also are printed to the console. The build will fail if Checkstyle fails.

Spotbugs

Spotbugs uses static analysis to look for bugs in the code. You can run spotbugs using:

The spotbugs warnings will be found in and files in the subproject build directories. Use -PxmlSpotBugsReport=true to generate an XML report instead of an HTML one.

直接跳到这里,看图操作

编译

失败原因:gradle版本太高,降低到4.8就ok了

编译(执行如下命令)

会在kafka/core/build/distributions目录下生成需要的tar包

PS:跟官网下载的tar包一样哦

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20181128G0ZMZK00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券
http://www.vxiaotou.com