8.4 KiB
Queue with IntelliJ IDEA
http://gatkforums.broadinstitute.org/gatk/discussion/1309/queue-with-intellij-idea
We have found it that Queue works best with IntelliJ IDEA Community Edition (free) or Ultimate Edition installed with the Scala Plugin enabled. Once you have downloaded IntelliJ IDEA, follow the instructions below to setup a Sting project with Queue and the Scala Plugin.
File:sting_project_libraries.png File:sting_module_sources.png File:sting_module_dependencies.png File:sting_module_scala_facet.png
1. Build Queue on the Command Line
Build Queue from source from the command line with ant queue, so that:
- The lib folder is initialized including the scala jars
- The
queue-extensionsfor the GATK are generated to the build folder
2. Add the scala plugin
- In IntelliJ, open the menu
File>Settings - Under the
IDE Settingsin the left navigation list selectPlugins - Click on the
Availabletab under plugins - Scroll down in the list of available plugins and install the
scalaplugin - If asked to retrieve dependencies, click
No. The correct scala libraries and compiler are already available in the lib folder from when you built Queue from the command line Restart IntelliJto load the scala plugin
3. Creating a new Sting Project including Queue
-
Select the menu
File...>New Project... -
On the first page of "New Project" select
Create project from scratchClickNext > -
On the second page of "New Project" select Set the project
Name:toStingSet theProject files location:to the directory where you checked out the Sting git repository, for example/Users/jamie/src/StingUncheckCreate ModuleClickFinish -
The "Project Structure" window should open. If not open it via the menu
File>Project Structure -
Under the
Project Settingsin the left panel of "Project Structure" selectProjectMake sure thatProject SDKis set to a build of1.6If the Project SDK only lists<No SDK>add aNew>JSDKpointing to/System/Library/Frameworks/JavaVM.framework/Versions/1.6 -
Under the
Project Settingsin the left panel of "Project Structure" selectLibrariesClick the plus (+) to create a new Project Library Set theName:toSting/libSelectAttach Jar DirectoriesSelect the path tolibfolder under your SVN checkout -
Under the
Project Settingsin the left panel of "Project Structure" selectModules -
Click on the
+box to add a new module -
On the first page of "Add Module" select
Create module from scratchClickNext \> -
On the second page of "Add Module" select Set the module
Name:toStingChange theContent rootto:<directory where you checked out the Sting SVN repository>ClickNext \> -
On the third page Uncheck all of the other source directories only leaving the
java/srcdirectory checked ClickNext \> -
On fourth page click
Finish -
Back in the
Project Structurewindow, under theModule 'Sting', on theSourcestab make sure the following folders are selectedSource Folders(in blue):public/java/srcpublic/scala/srcprivate/java/src(Broad only)private/scala/src(Broad only)build/queue-extensions/srcTest Source Folders(in green):public/java/testpublic/scala/testprivate/java/test(Broad only)private/scala/test(Broad only)
-
In the
Project Structurewindow, under theModule 'Sting', on theModule Dependenciestab select Click on the buttonAdd...Select the popup menuLibrary...Select theSting/liblibrary ClickAdd selected -
Refresh the Project Structure window so that it becomes aware of the Scala library in
Sting/libClick theOKbutton Reopen Project Structure via the menuFile>Project Structure - In the second panel, click on the
Stingmodule Click on the plus (+) button above the second panel module In the popup menu underFacetselectScalaOn the right underFacet 'Scala'set theCompiler library:toSting/libClickOK
4. Enable annotation processing
- Open the menu
File>Settings - Under
Project Settings [Sting]in the left navigation list selectCompilerthenAnnotation Processors - Click to enable the checkbox
Enable annotation processing - Leave the radio button
obtain processors from the classpathselected - Click
OK
5. Debugging Queue
Adding a Remote Configuration
-
In IntelliJ 10 open the menu
Run>Edit Configurations. -
Click the gold
[+]button at the upper left to open theAdd New Configurationpopup menu. -
Select
Remotefrom the popup menu. -
With the new configuration selected on the left, change the configuration name from 'Unnamed' to something like 'Queue Remote Debug'.
-
Set the
Hostto the hostname of your server, and thePortto an unused port. You can try the default port of 5005. -
From the
Use the following command line arguments for running remote JVM, copy the argument string. -
On the server, paste / modify your command line to run with the previously copied text, for example
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 Queue.jar -S myscript.scala .... -
If you would like the program to wait for you to attach the debugger before running, change
suspend=ntosuspend=y. - Back in IntelliJ, click
OKto save your changes.
Running with the Remote Configuration
- Ensure
Queue Remote Debugis selected via the configuration drop down orRun>Edit Configurations. - Set your breakpoints as you normally would in IntelliJ.
- Start your program by running the full java path (with the above -Xdebug -Xrunjdwp ...) on the server.
- In IntelliJ go to the
Run>Debug.
6. Binding javadocs and source
From Stack overflow:
Add javadocs:
Point IntelliJ to http://download.oracle.com/javase/6/docs/api/.
Go to File -> Project Structure -> SDKs -> Apple 1.x -> DocumentationPaths, and the click specify URL.
Add sources:
In IntelliJ, open File -> Project Structure. Click on "SDKs" under "Platform Settings". Add the following path under the Sourcepath tab: /Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home/src.jar!/src