blob: 7cdf187f7c0a12d21990a24bce47575175de50f4 [file] [log] [blame]
Flume Developer Notes
// This is in asciidoc markup
== Introduction
This is meant to be a a guide for issues that occur when building,
debugging and setting up Flume as developer.
== High level directory and file structure.
Flume uses the Maven build system and has a Maven project object model
(pom) that has many components broken down into Maven modules. Below
we describe the contents of different directories.
./bin/ Startup scripts
./conf/ Configuration file samples
./flume-ng-channels Channels
./flume-ng-clients Clients
./flume-ng-core Core module
./flume-ng-dist Distribution package module
./flume-ng-legacy-sources Legacy sources for compatibility
./flume-ng-node Node module
./flume-ng-sinks Sink modules (HDFS)
./flume-ng-sdk Client SDK for custom clients
The files exclusions in `.gitignore` are either autogenerated by Maven or Eclipse.
Similar exclusion are applied via the svn:ignore property for various directories.
== Building and Testing Flume
=== Prerequisites
You need to have Apache Maven installed.
=== Using Maven
We are using Maven v3.x. The Maven build system steps through several phases
to create build artefacts. At the highest level, the phases that are relevent
to most devs are "compile" -> "test" -> "package" -> "install".
A development build that runs unit tests and installs to local Maven repo.
This builds and tests all plugins.
mvn install
A development build that skips the execution of unit tests.
mvn install -DskipTests
A development build that runs unit tests. (no package generation)
mvn test
A development build that runs unit tests including only specific tests
(where <TestFile> is a regex of a class name without .java or .class
or path).
mvn test -Dtest=<ClassRegex>
==== Including or excluding specific sets of tests.
We've added hooks to the maven build that will enable you to exclude
or include specific tests on a test run. This is useful for excluding
flakey tests or making a build that focuses solely upon flakey tests.
To do this we created two variables:
# test.include.pattern
# test.exclude.pattern
These variables take regular expression patterns of the files to be
included or excluded.
For the next set of examples, let's say you have flakey test called
TestFlaky1 and TestFlaky2.
You can execute tests that skip TestFlaky1 and TestFlaky2 by using the
following command line:
mvn test -Dtest.exclude.pattern=**/TestFlaky*.java
Alternately, you could be more explicit
mvn test -Dtest.exclude.pattern=**/,**/
Conversely, you could execute only the flaky tests by using:
mvn test -Dtest.include.pattern=**/TestFlaky*.java
You can also have a combination of imports and exports. This runs
TestFlaky* but skips over TestFlaky2:
mvn test -Dtest.include.pattern=**/TestFlaky*.java -Dtest.exclude.pattern=**/
NOTE: Both test.exclude.pattern and test.include.pattern get
overridden if the test parameter is used. Consider:
mvn test -Dtest.exclude.pattern=**/TestFlaky*.java -Dtest=TestFlaky1
In this case, TestFlaky1 will be run despite being in the
=== Running the most recent build
To run the most recent build of Flume, first build the distribuion
mvn install -DskipTests
== Integrated Development Environments for Flume
Currently most Flume developers use the Eclipse IDE. We have included
some instructions for getting started with Eclipse.
=== Setting up a Flume Eclipse projects from the Maven POMs.
If you use Eclipse we suggest you use the m2eclipse plugin available
here to properly create an environment for dev and testing in Eclipse.
After installing it in Eclipse you will want to "Import" the Flume
pom.xml project.
This can be done by going to the Eclipse applications menu, navigating
to File > Import... > Existing Maven Projects. From there, browse to
and select the directory that contains the root of the Flume project.
Alternatively you could run mvn eclipse:eclipse from the top directory
and import the generated projects via Import > Existing Projects menu.
== Rules of the Repository
We have a few basic rules for code in the repository.
The master/trunk pointer:
* MUST always build.
* SHOULD always pass all unit tests
When commitng code we tag pushes with JIRA numbers, and their short descriptions.
Generally these are in the following format:
FLUME-42: Description from the jira
All source files must include the following header (or a variant
depending on comment characters):
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.