在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:kafka开源软件地址:https://gitee.com/apache/kafka开源软件介绍:Apache KafkaSee our web site for details on the project. You need to have Java installed. We build and test Apache Kafka with Java 8, 11 and 17. We set the Scala 2.12 and 2.13 are supported and 2.13 is used by default. Scala 2.12 support has been deprecated sinceApache Kafka 3.0 and will be removed in Apache Kafka 4.0 (see KIP-751for more details). See below for how to use a specific Scala version or all of the supported Scala versions. Build a jar and run it./gradlew jar Follow instructions in https://kafka.apache.org/quickstart Build source jar./gradlew srcJar Build aggregated javadoc./gradlew aggregatedJavadoc Build javadoc and scaladoc./gradlew javadoc./gradlew javadocJar # builds a javadoc jar for each module./gradlew scaladoc./gradlew scaladocJar # builds a scaladoc jar for each module./gradlew docsJar # builds both (if applicable) javadoc and scaladoc jars for each module Run unit/integration tests./gradlew test # runs both unit and integration tests./gradlew unitTest./gradlew integrationTest Force re-running tests without code change./gradlew -Prerun-tests test./gradlew -Prerun-tests unitTest./gradlew -Prerun-tests integrationTest Running a particular unit/integration test./gradlew clients:test --tests RequestResponseTest Repeatedly running a particular unit/integration testI=0; while ./gradlew clients:test -Prerun-tests --tests RequestResponseTest --fail-fast; do (( I=$I+1 )); echo "Completed run: $I"; sleep 1; done Running a particular test method within a unit/integration test./gradlew core:test --tests kafka.api.ProducerFailureHandlingTest.testCannotSendToInternalTopic./gradlew clients:test --tests org.apache.kafka.clients.MetadataTest.testTimeToNextUpdate Running a particular unit/integration test with log4j outputChange the log4j setting in either ./gradlew clients:test --tests RequestResponseTest Specifying test retriesBy default, each failed test is retried once up to a maximum of five retries per test run. Tests are retried at the end of the test task. Adjust these parameters in the following way: ./gradlew test -PmaxTestRetries=1 -PmaxTestRetryFailures=5 See Test Retry Gradle Plugin for more details. Generating test coverage reportsGenerate coverage reports for the whole project: ./gradlew reportCoverage -PenableTestCoverage=true -Dorg.gradle.parallel=false Generate coverage for a single module, i.e.: ./gradlew clients:reportCoverage -PenableTestCoverage=true -Dorg.gradle.parallel=false Building a binary release gzipped tar ball./gradlew clean releaseTarGz The release file can be found inside Building auto generated messagesSometimes it is only necessary to rebuild the RPC auto-generated message data when switching between branches, as they couldfail due to code changes. You can just run: ./gradlew processMessages processTestMessages Running a Kafka broker in ZooKeeper mode./bin/zookeeper-server-start.sh config/zookeeper.properties./bin/kafka-server-start.sh config/server.properties Running a Kafka broker in KRaft (Kafka Raft metadata) modeCleaning the build./gradlew clean Running a task with one of the Scala versions available (2.12.x or 2.13.x)Note that if building the jars with a version other than 2.13.x, you need to set the You can pass either the major version (eg 2.12) or the full version (eg 2.12.7): ./gradlew -PscalaVersion=2.12 jar./gradlew -PscalaVersion=2.12 test./gradlew -PscalaVersion=2.12 releaseTarGz Running a task with all the scala versions enabled by defaultInvoke the ./gradlewAll test./gradlewAll jar./gradlewAll releaseTarGz Running a task for a specific projectThis is for ./gradlew core:jar./gradlew core:test Streams has multiple sub-projects, but you can run all the tests: ./gradlew :streams:testAll Listing all gradle tasks./gradlew tasks Building IDE projectNote that this is not strictly necessary (IntelliJ IDEA has good built-in support for Gradle projects, for example). ./gradlew eclipse./gradlew idea The Publishing the jar for all versions of Scala and for all projects to mavenThe recommended command is: ./gradlewAll publish For backwards compatibility, the following also works: ./gradlewAll uploadArchives Please note for this to work you should create/update mavenUrl=mavenUsername=mavenPassword=signing.keyId=signing.password=signing.secretKeyRingFile= Publishing the streams quickstart archetype artifact to mavenFor the Streams archetype project, one cannot use gradle to upload to maven; instead the cd streams/quickstartmvn deploy Please note for this to work you should create/update user maven settings (typically, <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">... <servers> ... <server> <id>apache.snapshots.https</id> <username>${maven_username}</username> <password>${maven_password}</password> </server> <server> <id>apache.releases.https</id> <username>${maven_username}</username> <password>${maven_password}</password> </server> ... </servers> ... Installing ALL the jars to the local Maven repositoryThe recommended command to build for both Scala 2.12 and 2.13 is: ./gradlewAll publishToMavenLocal For backwards compatibility, the following also works: ./gradlewAll install Installing specific projects to the local Maven repository./gradlew -PskipSigning :streams:publishToMavenLocal If needed, you can specify the Scala version with Building the test jar./gradlew testJar Determining how transitive dependencies are added./gradlew core:dependencies --configuration runtime Determining if any dependencies could be updated./gradlew dependencyUpdates Running code quality checksThere are two code quality analysis tools that we regularly run, spotbugs and checkstyle. CheckstyleCheckstyle enforces a consistent coding style in Kafka.You can run checkstyle using: ./gradlew checkstyleMain checkstyleTest The checkstyle warnings will be found in SpotbugsSpotbugs uses static analysis to look for bugs in the code.You can run spotbugs using: ./gradlew spotbugsMain spotbugsTest -x test The spotbugs warnings will be found in JMH microbenchmarksWe use JMH to write microbenchmarks that produce reliable results in the JVM. See jmh-benchmarks/README.md for details on how to run the microbenchmarks. Common build optionsThe following options should be set with a
Dependency AnalysisThe gradle dependency debugging documentation mentions using the Alternatively, use the ./gradlew allDeps./gradlew allDepInsight --configuration runtimeClasspath --dependency com.fasterxml.jackson.core:jackson-databind These take the same arguments as the builtin variants. Running system testsSee tests/README.md. Running in VagrantSee vagrant/README.md. ContributionApache Kafka is interested in building the community; we would welcome any thoughts or patches. You can reach us on the Apache mailing lists. To contribute follow the instructions here: |
请发表评论