Setting up IntelliJ IDEA

These instructions assume IDEA version 8.1

  1. Check out Ambra head from svn
    • Follow the command-line instructions on Development Setup page
    • or Version Control -> Check out from version control -> Subversion
  2. Select File -> New Project
  3. Select Import project from external model
  4. Select Maven
    • Select root directory to your head dir
    • Check Keep .ipr and .iml files in to some directory that is not inside your Subversion tree (else you might end up having to re-create the project if you decide to wipe the head directory)
  5. Check all maven profiles and projects to import
  6. Use an external Maven
    • Click on Maven project on right hand tool panel
    • Click on Maven settings
  7. Go to File -> Project Structure
    • On the Project tab
      • For Project SDK, use the latest Java version available
      • For Project language level, use 5.0 (enum keyword, autoboxing, etc.)
    • On the Modules tab
      • In the module structure ambra-webapp -> Web -> Struts 2, select all of the libraries offered
      • In the module structure ambra-webapp -> Groovy, select Maven: org.codehaus.groovy:groovy-all
      • In the module structure ambra-webapp -> Spring, select only applicationContext.xml
    • Organize Project Modules into Module Groups (top level) and Module Subgroups
      • right click on module -> move to place each Module in the appropriate location (Module Groups and Module Subgroups can be created as needed)
      • The location of each Module should reflect the file path of that Module. For instance, if the Module all-journals is in directory /home/USER_NAME/topaz/head/ambra/journals/all-journals, then place the Module all-journals into the Module Subgroup journals inside the Module Group ambra. (See the following illustrations)
      • Module Group structure for the topaz/ambra project in the IntelliJ IDEA IDE (1 of 2)
      • Module Group structure for the topaz/ambra project in the IntelliJ IDEA IDE (2 of 2)
  8. The plugins JetGroovy? and Struts 2 should already be installed. If not, choose File -> Settings, select Plugins, and add the missing plugins.
  9. Set up Topaz code style
    • Copy TopazProject.xml to your Idea setup directory ( ~/.IntelliJIdea80/config/codestyles under Linux)
    • Go to File -> Settings
    • In the Project Settings section, select Code Style -> Imports
    • For the Scheme name: picklist, choose the name of the file you just copied
  10. Set the header content for new files
    • Go to File -> Settings -> Copyright -> Copyright Profiles
    • Create a new profile, naming it something clever like Topaz Project Copyright Profile
    • Copy the contents of TopazProjectCopyrightProfile.txt into the large form field
    • Click Validate to ensure that the template is valid and will be rendered correctly

Running Tasks

You can run all Maven tasks

  • Click Maven Projects in the right-hand margin
  • Click Topaz Project -> Lifecycle

The first time this project is created in an Idea installation

  • Click Profiles and de-select all the checked Profiles
  • Under Topaz Project -> Lifecycle
    • Right-click on the clean task and select Run (do not be surprised if this gives errors)
    • Right-click on the install task and select Run

Subsequent to installation

  • To build or rebuild the whole project
    • Under Topaz Project -> Lifecycle
      • Control-click both clean and install tasks
      • Right-click and select Run
  • To build or rebuild just the Ambra portion of the project
    • Under Modules -> Ambra application -> Lifecycle
      • Control-click both clean and install tasks
      • Right-click and select Run
  • To run the Jetty application server
    • Under Topaz Project -> Modules -> Ambra application -> Modules -> Ambra Web Application -> Plugins -> jetty
      • Control-click the jetty:run task
      • Right-click and select Run

Addenda

  • To add one or more tasks to a picklist at the top of the screen (the Run menu)
    • Select the desired tasks (control-click for multiple tasks)
    • Right-click and choose the Select... option (next to the little blue gear)
  • You can run jetty:run task in debug mode too

Setting jetty with embedded mulgara and simple blob store without need for ambra.xml

IDEA jetty run setup

Example parameters:

-Dambra.topaz.tripleStore.mulgara.baseuri=local:///topazproject
-Dambra.topaz.blobStore.beanName=simpleBlobStore
-Dambra.topaz.tripleStore.mulgara.dbDir=/home/dkrsmanovic/MulgaraDB/topazproject
-Dambra.topaz.blobStore.simple.directory=/home/dkrsmanovic/BlobStore
-Dambra.services.documentManagement.ingestSourceDir=/home/dkrsmanovic/Topaz/ingest/
-Dambra.services.documentManagement.ingestDestinationDir=/home/dkrsmanovic/Topaz/ingested/
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.local.only=false
-Dambra.platform.dummySsoEnable=true
-Xmx512m

Note that the directories included in the parameter list must exist. In this case, the directories MulgaraDB/topazproject, BlobStore?, ingest, and ingested had to be created.

Recomended JVM parameters from IDEA

Edit ~/idea-xxxx/bin/idea.vmoptions

-Xms32m
-Xmx512m
-XX:MaxPermSize=256m
-ea

Attachments