Development Environment Setup
This page helps you to get your development environment up and running.
Setting up Git
We use Git to manage Crunch's source code. Before contributing patches you have to configure Git so that any patches you create are correctly attributed to you. Run the following commands, replacing the placeholders with your full name and email address:
No Format |
---|
$ git config --global user.name "Your Name" $ git config --global user.email "your.address@example.com" |
If you have never worked with Git before it's a good idea to make yourself familiar with it, for example by reading the first chapters of the free Pro Git book.
Getting the Source Code
You get the code by cloning the central repository:
No Format |
---|
$ git clone http://git-wip-us.apache.org/repos/asf/crunch.git |
Building Crunch
To build the project run the following Maven command:
No Format |
---|
$ mvn package |
To install the created JARs in your local Maven cache and also run the integration test suite:
No Format |
---|
$ mvn install |
Depending on your system, the test suite may take quite a while, but if you want to contribute to Crunch it's important that it works. Please tell us if there are any problems.
Setting Up Eclipse
Here's how you set up Eclipse for Crunch, assuming you use the m2e Eclipse plugin. First of all, import the code:
- Open the import dialog: File > Import
- Select import via the m2e plugin: Maven > Existing Maven Projects
- In the dialog box select Crunch's root directory and hit Finish
- Add
crunch/target/generated-test-sources/
to the build path: Right-click on the directory, then select Build Path > Use as Source Folder
There are lots of warnings about missing serialVersionUID
fields. They would clutter the code, so we ignore them:
- Select the
crunch
module - Open the preferences menu: Window > Preferences
- Select Java > Compiler > Errors/Warnings
- Toggle Ignore on Potential programming problems / Serializable class without serialVersionUID
Import our formatter that is consistent with our coding style:
- Open the preferences menu: Window > Preferences
- Select Java > Code Style > Formatter
- Hit Import and pick
crunch/src/main/config/crunch-formatting-styles.xml
Last but not least set up Eclipse's Checkstyle plugin:
- Open the preferences menu: _Window > Preferences
- Select Checkstyle and hit the New... button
- Select Project Relative Configuration from the Type drop-down box
- Enter "Crunch Coding Style" into the Name field
- Hit Browse and select
crunch/src/main/config/checkstyle.xml
, then hit OK
Now apply the Checkstyle config to the Crunch project:
- Select the
crunch
module - Right-Click on Properties
- Select Checkstyle
- Pick "Crunch Coding Style" from the drop-down box
- Tick Checkstyle active for this project
- Hit OK