Since GATK 3.0, we use Apache Maven (instead of Ant) as our build system, and IntelliJ as our IDE (Integrated Development Environment). This document describes how to get set up to use Maven as well as how to create an IntelliJ project around our Maven project structure.
Check whether you can run
mvn --version on your machine. If you can't, install Maven from here.
Ensure that the JAVA_HOME environment variable is properly set. If it's not, add the appropriate line to your shell's startup file:
setenv JAVA_HOME \`/usr/libexec/java_home\`
Note that the commands above use backticks, not single quotes.
To compile everything, type:
To compile the GATK but not Queue (much faster!), the command is:
mvn verify -P\!queue
Note that the
! needs to be escaped with a backslash to avoid interpretation by the shell.
To obtain a clean working directory, type:
If you're used to using ant to compile the GATK, you should be able to feed your old ant commands to the
ant-bridge.sh script in the root directory. For example:
./ant-bridge.sh test -Dsingle=MyTestClass
mvn test-compile in your git clone's root directory.
File -> import project, select your git clone directory, then click ok
On the next screen, select "import project from external model", then "maven", then click "next"
Click "next" on the next screen without changing any defaults -- in particular:
On the "Select Profiles" screen, make sure private and protected are NOT checked, then click next.
On the next screen, the "sting-aggregator" project should already be checked for you -- if not, then check it. Click next.
Select the 1.7 SDK, then click next.
Select an appropriate project name (can be anything), then click next.
Click "Finish" to create the new IntelliJ project.
That's it! Due to Maven magic, everything else will be set up for you automatically, including modules, libraries, Scala facets, etc.
You will see a popup "Maven projects need to be imported" on every IntelliJ startup. You should click import unless you're working on the actual pom files that make up the build system.
Hi, this took me a while to debug, so I'm posting the solution here. I started by downloading a clean copy of GATK core platform from GitHub. When I first tried building by running ant, I got the compiler errors below. The reason turned out to be that an unrelated jar (gsea2-2.0.12.jar) was on my CLASSPATH (this is from another Broad tool I've been using - Gene Set Enrichment Analysis). gsea2-2.0.12.jar apparently contains outdated versions of apache math and io packages which conflict with the GATK versions. Taking this jar off my CLASSPATH fixed the issue.
Ps. the compiler errors were:
gatk.compile.internal.source: [javac] Compiling 681 source files to /prog/GATK/gatk_platform_git/build/java/classes [javac] /prog/GATK/gatk_platform_git/public/java/src/org/broadinstitute/sting/commandline/ParsingEngine.java:260: error: incompatible types [javac] for (String line: FileUtils.readLines(file)) [javac] ^ [javac] required: String [javac] found: Object [javac] /prog/GATK/gatk_platform_git/public/java/src/org/broadinstitute/sting/utils/MannWhitneyU.java:50: error: no suitable constructor found for NormalDistributionImpl(double,double,double) [javac] private static NormalDistribution APACHE_NORMAL = new NormalDistributionImpl(0.0,1.0,1e-2); [javac] ^ [javac] constructor NormalDistributionImpl.NormalDistributionImpl() is not applicable [javac] (actual and formal argument lists differ in length) [javac] constructor NormalDistributionImpl.NormalDistributionImpl(double,double) is not applicable [javac] (actual and formal argument lists differ in length) [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 2 errors BUILD FAILED /prog/GATK/gatk_platform_git/build.xml:454: Compile failed; see the compiler error output for details.