Setting Up a Development Environment (including Eclipse and Netbeans IDE info)

From OpenQuote

Jump to: navigation, search

This page details how to get started with development on OpenQuote, specific tips on using NetBeans and Eclipse IDE's are provided, although any Java IDE should be suitable.

The complete source for OpenQuote Community is made up of 6 projects: development, core, commercial, insurance, openquote and community. You don't need to check-out all of these projects, you can save yourself a lot of SVN time, not to mention a lot of disk space, if you only check-out the ones you intend to work in.

Contents

The Environment

Before starting any of the tasks below this section, ensure you have got the following (may be obvious) in place:

  • Set an environment variable available named JAVA_HOME and that it points to you latest and best Java JDK directory.
  • Start MySql server running, this should be installed independently and have a root user with a password bombay2000 [this is case-sensitive].
OS X users Tip
  • The line JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home should be placed in a file located at and name: <USER HOME DIRECTORY>/.profile

Source Code

You can get a copy of the source either from the openquote project's download section on SourceForge, or direct from the project's SVN repository.

The SVN repository is located here: https://oquote.svn.sourceforge.net/svnroot/oquote.

You won't need a username or password to check-out the source code.

Eclipse Tip
  • Eclipse does not have SVN support by default, to add in SVN follow the download and install instructions on this website: http://subclipse.tigris.org/.
  • Start by adding https://oquote.svn.sourceforge.net/svnroot/oquote to your list of SVN repositories. If you open the repository up, and browse down to root/projects/openquote/2.0 (or which ever version you require), you will see all six of the projects.
NetBeans Tip

The 'development' Project

No matter which project you intend to work on, you will always need the development project.

  1. From SVN check-out the development folder.
  2. In the check-out tree, under development, you'll find a Build.xml file, run the "setup" target. This will download all the jars essential for the build itself.
    • Note: If this is not the first time you have ran this setup and this is a "refresh" check-out, you'll need to remove all of the jars from development/build/libs from the Ant classpath.
  3. Refresh the development project in the IDE (not required in Netbeans).
  4. Now add all of the jars in development/build/libs into the Ant classpath.
Eclipse Tips
  • Access SVN via the SVN perspective in Eclipse.
  • To simplify running Ant target, drag the Ant file (i.e. Build.xml) drag the file into the Eclipse Ant view and then click the "Hide Internal Targets" option. You'll see just four targets now; these same four targets appear in every Build.xml file throughout the OpenQuote projects.
  • The Ant classpath can be found in the preferences window of Eclipse (Eclipse->Preferences), from here go to Ant->Runtime and select the "Global Entries" classpath.
Netbeans Tips
  • Access SVN via the menus Team->Subversion->Checkout in Netbeans.
  • To run an Ant target in Netbeans, right click the Ant file (i.e. Build.xml), select 'Run Target' and then click the target to run.
  • The Ant classpath can be found in the preferences window of Netbeans (Netbeans->Preferences), from here go to Miscellaneous item and select the Ant tab.

The 'openquote' Project

From here on we will assume you only need to work in the openquote project. The process is very similar for and of the OpenQuote Community projects.

  1. From SVN, check-out the openquote project.
  2. In the check-out tree, you will now find an Ant Build.xml file under openquote, run the "setup" target.

Common Build Targets

You'll find Build.xml files in every project, and in every component within each project. Each defines four targets:

  • setup - Puts the project into a state ready for work. Typically, you run this when you've just checked a project out from SVN. It will take care of downloading any dependent jars, setting up databases, or installing JBoss when necessary. Obviously, you don't want to be doing any of those things in a typical edit-build-test loop, so you won't run this target very frequently.
  • build - Takes care of compilation style steps. In the edit-build-test loop, this is the target you'd use to build. You'll be running these targets a lot, they are designed to be as quick as possible so as to interrupt you as little as possible!
  • clean - Undoes whatever "build" did. Build is light-weight, so is clean - this will remove class files etc, but it won't touch the database, or uninstall dependent jars etc.
  • teardown - Undoes whatever setup did. This will clean out databases etc.. From the top level of a project, this will delete everything under target/, and delete the project's database.

Starting and Stopping JBoss

In the OpenQuote project there is an Ant file called BuildCommands.xml, this contains a number of useful commands including:

  • JBoss: start server - Starts the JBoss server.
  • JBoss: stop server - Stops the JBoss server.

Building the Code

When changes have been made to the code, simply select the Ant target "build" in the project's Build.xml file.

If Jboss is running the build target will automatically redeploy the app it so it picks up the code changes right away.

The build server can be accessed at localhost:8080.

IDE Classpath for 'openquote' Project

To make certain the IDE does not show source errors when editing, the project class path should include the following directories and jars:

Class Directories
openquote/target/jboss/server/default/deploy/openquote.ear/lib/commercial.jar/
openquote/target/jboss/server/default/deploy/openquote.ear/lib/core.jar/
openquote/target/jboss/server/default/deploy/openquote.ear/lib/insurance.jar/
openquote/target/jboss/server/default/deploy/openquote.ear/*.jar/
Jars (all jars contained within the following directories)
development/build/lib/
openquote/target/jboss/client/
openquote/target/jboss/server/default/deploy/jboss-portal.sar/lib/
openquote/target/jboss/server/default/deploy/openquote.ear/lib/
openquote/target/jboss/server/default/deploy/jboss-web.deployer/jsf-libs/
Personal tools