2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Apache Kafka
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								=================
							 
						 
					
						
							
								
									
										
										
										
											2019-04-23 02:58:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								See our [web site ](https://kafka.apache.org ) for details on the project.
							 
						 
					
						
							
								
									
										
										
										
											2011-08-02 07:41:24 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-11-22 00:06:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								You need to have [Java ](http://www.oracle.com/technetwork/java/javase/downloads/index.html ) installed.
							 
						 
					
						
							
								
									
										
										
										
											2016-01-27 07:33:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:36:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								We build and test Apache Kafka with Java 8, 11 and 15. We set the `release`  parameter in javac and scalac
							 
						 
					
						
							
								
									
										
										
										
											2020-05-06 13:20:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								to `8`  to ensure the generated binaries are compatible with Java 8 or higher (independently of the Java version
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								used for compilation).
							 
						 
					
						
							
								
									
										
										
										
											2018-10-29 02:31:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-23 22:02:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Scala 2.13 is used by default, see below for how to use a different Scala version or all of the supported Scala versions.
							 
						 
					
						
							
								
									
										
										
										
											2014-09-24 00:06:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Build a jar and run it ###
  
						 
					
						
							
								
									
										
										
										
											2016-09-15 01:38:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew jar
							 
						 
					
						
							
								
									
										
										
										
											2011-08-02 07:41:24 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-12 10:23:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Follow instructions in https://kafka.apache.org/quickstart
							 
						 
					
						
							
								
									
										
										
										
											2011-08-02 07:41:24 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Build source jar ###
  
						 
					
						
							
								
									
										
										
										
											2014-04-19 04:10:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew srcJar
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Build aggregated javadoc ###
  
						 
					
						
							
								
									
										
										
										
											2016-05-19 07:44:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew aggregatedJavadoc
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Build javadoc and scaladoc ###
  
						 
					
						
							
								
									
										
										
										
											2014-04-19 04:10:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew javadoc
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 07:44:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew javadocJar # builds a javadoc jar for each module
							 
						 
					
						
							
								
									
										
										
										
											2014-04-19 04:10:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew scaladoc
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 07:44:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew scaladocJar # builds a scaladoc jar for each module
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew docsJar # builds both (if applicable) javadoc and scaladoc jars for each module
							 
						 
					
						
							
								
									
										
										
										
											2014-04-19 04:10:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Run unit/integration tests ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew test # runs both unit and integration tests
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew unitTest
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew integrationTest
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Force re-running tests without code change ###
  
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew cleanTest test
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew cleanTest unitTest
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew cleanTest integrationTest
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Running a particular unit/integration test ###
  
						 
					
						
							
								
									
										
										
										
											2018-11-30 08:04:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew clients:test --tests RequestResponseTest
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Running a particular test method within a unit/integration test ###
  
						 
					
						
							
								
									
										
										
										
											2015-10-19 13:45:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew core:test --tests kafka.api.ProducerFailureHandlingTest.testCannotSendToInternalTopic
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew clients:test --tests org.apache.kafka.clients.MetadataTest.testMetadataUpdateWaitTime
							 
						 
					
						
							
								
									
										
										
										
											2015-01-26 11:15:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Running a particular unit/integration test with log4j output ###
  
						 
					
						
							
								
									
										
										
										
											2015-12-16 02:55:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Change the log4j setting in either `clients/src/test/resources/log4j.properties`  or `core/src/test/resources/log4j.properties` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-30 08:04:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew clients:test --tests RequestResponseTest
							 
						 
					
						
							
								
									
										
										
										
											2014-03-01 05:53:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-06 08:41:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Specifying test retries ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								By 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 ](https://github.com/gradle/test-retry-gradle-plugin ) for more details.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-01 01:07:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Generating test coverage reports ###
  
						 
					
						
							
								
									
										
										
										
											2017-02-11 01:15:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Generate coverage reports for the whole project:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 22:32:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew reportCoverage -PenableTestCoverage=true
							 
						 
					
						
							
								
									
										
										
										
											2016-04-01 01:07:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-02-11 01:15:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Generate coverage for a single module, i.e.: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 22:32:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew clients:reportCoverage -PenableTestCoverage=true
							 
						 
					
						
							
								
									
										
										
										
											2017-02-11 01:15:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Building a binary release gzipped tar ball ###
  
						 
					
						
							
								
									
										
										
										
											2018-10-29 02:31:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew clean releaseTarGz
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 02:55:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The above command will fail if you haven't set up the signing key. To bypass signing the artifact, you can run:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-29 02:31:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew clean releaseTarGz -x signArchives
							 
						 
					
						
							
								
									
										
										
										
											2011-08-02 07:41:24 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 02:55:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The release file can be found inside `./core/build/distributions/` .
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 05:48:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 04:29:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Building auto generated messages ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Sometimes it is only necessary to rebuild the RPC auto-generated message data when switching between branches, as they could
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								fail due to code changes. You can just run:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew processMessages processTestMessages
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Cleaning the build ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew clean
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-01-07 02:51:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Running a task with one of the Scala versions available (2.12.x or 2.13.x) ###
  
						 
					
						
							
								
									
										
										
										
											2020-09-08 22:11:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*Note that if building the jars with a version other than 2.13.x, you need to set the `SCALA_VERSION`  variable or change it in `bin/kafka-run-class.sh`  to run the quick start.*
							 
						 
					
						
							
								
									
										
										
										
											2018-10-29 02:31:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								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
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 02:55:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 00:26:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Running a task with all the scala versions enabled by default ###
  
						 
					
						
							
								
									
										
										
										
											2015-12-16 02:55:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-20 10:24:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Invoke the `gradlewAll`  script followed by the task(s):
							 
						 
					
						
							
								
									
										
										
										
											2018-10-29 02:31:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-20 10:24:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlewAll test
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlewAll jar
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlewAll releaseTarGz
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Running a task for a specific project ###
  
						 
					
						
							
								
									
										
										
										
											2015-12-16 02:55:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								This is for `core` , `examples`  and `clients` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew core:jar
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew core:test
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 05:48:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-25 04:30:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Streams has multiple sub-projects, but you can run all the tests:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew :streams:testAll
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Listing all gradle tasks ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew tasks
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 05:48:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Building IDE project ####
  
						 
					
						
							
								
									
										
										
										
											2015-12-16 02:55:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*Note that this is not strictly necessary (IntelliJ IDEA has good built-in support for Gradle projects, for example).*
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew eclipse
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew idea
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 05:48:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-02-10 10:37:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The `eclipse`  task has been configured to use `${project_dir}/build_eclipse`  as Eclipse's build directory. Eclipse's default
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								build directory (`${project_dir}/bin`) clashes with Kafka's scripts directory and we don't use Gradle's build directory
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								to avoid known issues with this configuration.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Publishing the jar for all version of Scala and for all projects to maven ###
  
						 
					
						
							
								
									
										
										
										
											2020-04-20 10:24:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlewAll uploadArchives
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 05:48:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-09-18 06:01:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Please note for this to work you should create/update `${GRADLE_USER_HOME}/gradle.properties`  (typically, `~/.gradle/gradle.properties` ) and assign the following variables
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 05:48:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    mavenUrl=
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mavenUsername=
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mavenPassword=
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    signing.keyId=
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    signing.password=
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    signing.secretKeyRingFile=
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 05:48:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-12 03:19:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Publishing the streams quickstart archetype artifact to maven ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								For the Streams archetype project, one cannot use gradle to upload to maven; instead the `mvn deploy`  command needs to be called at the quickstart folder:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    cd streams/quickstart
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mvn deploy
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Please note for this to work you should create/update user maven settings (typically, `${USER_HOME}/.m2/settings.xml` ) to assign the following variables
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < 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 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     ...
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-09 07:13:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Installing the jars to the local Maven repository ###
  
						 
					
						
							
								
									
										
										
										
											2020-04-20 10:24:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlewAll install
							 
						 
					
						
							
								
									
										
										
										
											2015-05-30 05:50:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Building the test jar ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew testJar
							 
						 
					
						
							
								
									
										
										
										
											2014-02-08 05:48:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Determining how transitive dependencies are added ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew core:dependencies --configuration runtime
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 02:55:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-04 07:10:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Determining if any dependencies could be updated ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew dependencyUpdates
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-01 07:04:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Running code quality checks ###
  
						 
					
						
							
								
									
										
										
										
											2018-09-11 04:14:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								There are two code quality analysis tools that we regularly run, spotbugs and checkstyle.
							 
						 
					
						
							
								
									
										
										
										
											2017-03-01 07:04:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-21 17:55:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#### Checkstyle ####
  
						 
					
						
							
								
									
										
										
										
											2017-03-01 07:04:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Checkstyle enforces a consistent coding style in Kafka.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								You can run checkstyle using:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-02-03 13:36:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew checkstyleMain checkstyleTest
							 
						 
					
						
							
								
									
										
										
										
											2011-08-02 07:41:24 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-01 07:04:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The checkstyle warnings will be found in `reports/checkstyle/reports/main.html`  and `reports/checkstyle/reports/test.html`  files in the
							 
						 
					
						
							
								
									
										
										
										
											2019-12-18 23:19:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								subproject build directories. They are also printed to the console. The build will fail if Checkstyle fails.
							 
						 
					
						
							
								
									
										
										
										
											2017-03-01 07:04:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-11 04:14:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#### Spotbugs ####
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Spotbugs uses static analysis to look for bugs in the code.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								You can run spotbugs using:
							 
						 
					
						
							
								
									
										
										
										
											2017-03-01 07:04:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-11 04:14:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ./gradlew spotbugsMain spotbugsTest -x test
							 
						 
					
						
							
								
									
										
										
										
											2017-03-01 07:04:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-11 04:14:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The spotbugs warnings will be found in `reports/spotbugs/main.html`  and `reports/spotbugs/test.html`  files in the subproject build
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								directories.  Use -PxmlSpotBugsReport=true to generate an XML report instead of an HTML one.
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 09:26:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-11 09:56:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### JMH microbenchmarks ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								We use [JMH ](https://openjdk.java.net/projects/code-tools/jmh/ ) to write microbenchmarks that produce reliable results in the JVM.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								See [jmh-benchmarks/README.md ](https://github.com/apache/kafka/blob/trunk/jmh-benchmarks/README.md ) for details on how to run the microbenchmarks.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-09 07:13:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Common build options ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-21 18:29:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								The following options should be set with a `-P`  switch, for example `./gradlew -PmaxParallelForks=1 test` .
							 
						 
					
						
							
								
									
										
										
										
											2016-01-09 07:13:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-04 06:24:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `commitId` : sets the build commit ID as .git/HEAD might not be correct if there are local commits added for build purposes. 
						 
					
						
							
								
									
										
										
										
											2017-04-21 18:29:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `mavenUrl` : sets the URL of the maven deployment repository (`file://path/to/repo` can be used to point to a local repository). 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `maxParallelForks` : limits the maximum number of processes for each task. 
						 
					
						
							
								
									
										
										
										
											2020-09-02 06:12:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `ignoreFailures` : ignore test failures from junit 
						 
					
						
							
								
									
										
										
										
											2017-04-21 18:29:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `showStandardStreams` : shows standard out and standard error of the test JVM(s) on the console. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `skipSigning` : skips signing of artifacts. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `testLoggingEvents` : unit test events to be logged, separated by comma. For example `./gradlew -PtestLoggingEvents=started,passed,skipped,failed test` . 
						 
					
						
							
								
									
										
										
										
											2018-09-11 04:14:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `xmlSpotBugsReport` : enable XML reports for spotBugs. This also disables HTML reports as only one can be enabled at a time. 
						 
					
						
							
								
									
										
										
										
											2020-02-06 08:41:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `maxTestRetries` : the maximum number of retries for a failing test case. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `maxTestRetryFailures` : maximum number of test failures before retrying is disabled for subsequent tests. 
						 
					
						
							
								
									
										
										
										
											2020-06-19 22:32:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  `enableTestCoverage` : enables test coverage plugins and tasks, including bytecode enhancement of classes required to track said 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								coverage. Note that this introduces some overhead when running tests and hence why it's disabled by default (the overhead
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								varies, but 15-20% is a reasonable estimate).
							 
						 
					
						
							
								
									
										
										
										
											2016-01-09 07:13:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-11-16 17:08:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Dependency Analysis ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The gradle [dependency debugging documentation ](https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html ) mentions using the `dependencies`  or `dependencyInsight`  tasks to debug dependencies for the root project or individual subprojects.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Alternatively, use the `allDeps`  or `allDepInsight`  tasks for recursively iterating through all subprojects:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew allDeps
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ./gradlew allDepInsight --configuration runtime --dependency com.fasterxml.jackson.core:jackson-databind
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								These take the same arguments as the builtin variants.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-14 21:21:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Running system tests ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								See [tests/README.md ](tests/README.md ).
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-12-05 21:37:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Running in Vagrant ###
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								See [vagrant/README.md ](vagrant/README.md ).
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-14 11:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Contribution ###
  
						 
					
						
							
								
									
										
										
										
											2013-07-11 23:06:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-15 01:16:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Apache Kafka is interested in building the community; we would welcome any thoughts or [patches ](https://issues.apache.org/jira/browse/KAFKA ). You can reach us [on the Apache mailing lists ](http://kafka.apache.org/contact.html ).
							 
						 
					
						
							
								
									
										
										
										
											2013-07-11 23:06:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								To contribute follow the instructions here:
							 
						 
					
						
							
								
									
										
										
										
											2019-04-23 02:58:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  https://kafka.apache.org/contributing.html