This document describes how you can setup your development environment.
Prerequisites
You need Java 1.6+ and Maven 3.0+ for build and runtime. You also need wget for running hive e2e tests.
Getting the source code
Sentry uses git for version control. Get the source code on your machine using Git. All development is done on branch "master".
$ git clone https://git-wip-us.apache.org/repos/asf/sentry.git
Once the checkout is complete, you can build these by using mvn install
as follows from within the workspace root.
$ cd sentry $ mvn clean install -DskipTests
Note that specifying *-DskipTests
to mvn
results in the skipping of all unit tests. This may be a good thing if you want to quickly setup the development environment. However, in the general case when you are making or testing changes, you must always run the tests. You can do that by running mvn install
without the -DskipTests
option, or explicitly by running mvn test
.
Built Artifacts
The module sentry-dist
within the source tree packages the built artifacts.
$ ls /path/to/workspace/sentry-dist/target sentry-dist/target/apache-sentry-1.7.0-SNAPSHOT-bin.tar.gz sentry-dist/target/apache-sentry-1.7.0-SNAPSHOT-src.tar.gz sentry-dist/target/apache-sentry-1.7.0-SNAPSHOT-bin
Setting up IntelliJ
You can setup Sentry project as any other maven project: File -> Import project - > click on the project top level pom.xml. Your Sentry project is now imported into IntelliJ for development.
Possible issues while running e2e tests from IDE:
- Error "Path to hadoop bin ./target/hadoop/bin/hadoop":
The first time you need to do a mvn test -f sentry-tests/sentry-tests-hive/pom.xml, so that hadoop and hive binaries are downloaded the first time into sentry-tests-hive/target. Then, for running these tests from IDE, you can either:- Symnlink hive and hadoop folders to target/. (top level). or
- Change workspace in your test configuration to sentry-tests-hive
- Error "this class is either not enhanced or you have multiple copies of jdo-api.jar in your CLASSPATH!":
You need to enhance the jdo classes (mvn -f sentry-service/sentry-service-server/pom.xml datanucleus:enhance) - Error "Caused by: java.lang.ClassNotFoundException: jdbm.helper.CachePolicy"
Go to sentry->sentry-provider->sentry-provider-db right click and go to Open Module Setting. Add the jdbm dependency from the location ~/.m2/repository/org/apache/directory/jdbm/apacheds-jdbm1/2.0.0-M2/apacheds-jdbm1-2.0.0-M2.jar