Sunday, March 16, 2008

Development Environment

Copied from Matt Raible: http://appfuse.org/display/APF/Development+Environment
For personal reference (before my wiki is setup)

-------------------
Development Environment
Added by Matt Raible, last edited by Matt Raible on Nov 24, 2007 11:02

About this Tutorial

This tutorial describes how to setup your development environment to compile/test/deploy AppFuse using Maven and your favorite IDE (Eclipse, IDEA or NetBeans). Eclipse works well for single-module projects, whereas IDEA and NetBeans work better with multi-module projects. Knowledge of Maven is not required to use AppFuse because the tutorials explain how to use it. If you're interested in learning Maven in-depth, please download the book Better Builds with Maven (it's free!).

Table of Contents

  1. Download - links to download Java, Maven and MySQL
  2. Install - detailed instructions on where to install everything
  3. Configure - how to configure your environment variables
  4. Additional Tips - tools to boost your productivity

Download

  1. Download Java 5 SE. AppFuse should work fine with Java 6, but Maven has issues with multi-module projects.
  2. Download Maven 2.0.5+.
  3. Download MySQL 5.0.27+.

Downloading these files to your desktop should work just fine.

Install

Make sure you have 7-Zip or WinZip installed (for Windows) and gnutar for OS X before installing these packages. Linux users should be fine with the default tar tools.

  1. Create a "Tools" and "SDKs" folder on your hard drive. On Windows, I create these at c:\Tools and c:\SDKs. On *nix, I usually do /opt/dev/tools and install Java in the default locations. Make sure and install Sun's Java if you're on Linux. Now that it's GPL, it shouldn't be difficult to apt-get.
  2. Create Environment variables for these folders - SDKS_HOME and TOOLS_HOME (optional)
  3. Install Java SE (a.k.a. JDK) in the SDKs directory - keeping the directory names intact.
  4. Unzip/Install Maven in the Tools directory - "maven-x" is what I use for the directory name, where x is the version number.
  5. Install MySQL in the Tools directory.
  6. Create a "Source" directory on your hard drive (this is where you'll put all your projects and their source code). On *nix, I usually create a "dev" folder in my home directory.

At this point, you should have a directory structure that looks something like the following:

SDKs
- jdk1.5.0_10
Tools
- maven-2.0.5
- mysql
Source

After installing these tools, you'll need to setup an SMTP server as well. If there's an existing server you'd like to use, simply change the host name in src/main/resources/mail.properties.

Now you'll need to configure all these tools so that your operating system knows they're installed.

Configure

A Windows example is the only one shown here because it's assume the *nix folks are smart enough to figure it out for their system.

  1. To set Environment Variables in Windows, either go to Control Panel -> System or right-click My Computer -> Properties.
  2. Click on the _Advanced_ Tab and then click the _Environment Variables_ button.
  3. Put focus on the second box (System Variables) by clicking on one of the existing values.
  4. Enter the following variables:
    • HOME = c:\Source
    • SDKS_HOME = c:\SDKs
    • TOOLS_HOME = c:\Tools
    • JAVA_HOME = %SDKS_HOME%\jdk1.5.0_10
    • MAVEN_HOME = %TOOLS_HOME%\maven-2.0.5
    • MYSQL_HOME = %TOOLS_HOME%\mysql
    • Append to the PATH variable: %JAVA_HOME%\bin;%MAVEN_HOME%\bin;%MYSQL_HOME%\bin

You should now be able to open a command prompt and type "java -version", "mvn -version" or "mysql" and not get errors.

Additional Tips

  • Use Cygwin on Windows for running Maven and doing all command line things. Install it in $TOOLS_HOME/cygwin.
  • Use Eclipse or IDEA. Install them in $TOOLS_HOME/eclipse-x or $TOOLS_HOME/idea-x. Multi-module Maven projects seem to work best in IDEA. NetBeans also has excellent Maven support, but it's not widely used among AppFuse developers and users. In Eclipse, Ctrl+Shift+R is your best friend; Ctrl+Shift+N in IDEA. See IDEs for more information on setting up an AppFuse-based project in your favorite IDE (Eclipse, IDEA, or NetBeans).

If you're starting work at a new client or at your company, you should do the following to help your development process become more efficient.

  1. Setup a source control system. Subversion is highly recommended. Setting up a commit notification system is recommended when working with other developers. FishEye works great.
  2. Setup a bug tracking system. Popular (free) choices are Bugzilla and Trac. The best one we've seen is JIRA. For more information see What issue tracking system is best for you?
  3. Setup a Wiki. We love Confluence - but it's not free. Other recommended systems are JSPWiki and Trac. Trac has a wiki, source control browser and bug-tracking system all-in-one.
  4. Setup a development box to host the source control system, the bug tracking system, and a wiki. Install Hudson, CruiseControl, Luntbuild or Continuum on this box to do continuous integration for your project. Setting up continuous integration with a Maven 2 project is a piece-of-cake, so you have no excuses! If you're interested in commercial CI systems, checkout Pulse or Bamboo. See Which open source CI tool is best suited for your application's environment? for more information on choosing a CI Server.
  5. (optional) Install Roller and use it to report your daily status and issues. This will allow your client (or supervisor) to track your progress.
Buildix Rocks!
Buildix is a VMWare image (that can be installed on bare metal) that has Subversion, CruiseControl and Trac all pre-installed. Using it is highly recommended.

If installing and configuring all of this software doesn't boost your productivity, please read Tips for Productivity and Happiness at Work for more suggestions.

No comments: