Developer Environment Setup Instructions

From wiki.searchtechnologies.com
Jump to: navigation, search

For Information on Aspire 3.1 Click Here

The following are the complete instructions for setting up the standard development environment for Java and Open Source projects.

Generally, the following instructions assume an MS-Windows based operating system.

Note that these are recommendations for a complete system. Naturally, these instructions will need to be tailored if your company uses some other source code control system other than Subversion (for example).

PART I: Install Java JDK 1.6

You will need the Java 1.6 (or later) to run Aspire. Note that we recommend installing the Java JDK (Java Development Kit), just in case you want to create your own Aspire Components in the future. But really, only the JRE (Java Runtime Environment) is absolutely required.

  1. Download and install the latest version of the Java JDK appropriate for the system that will run Aspire: http://java.com/en/download/manual.jsp
    • If you have a 64 bit machine, we recommend installing the 64 bit version of Java. That will allow you to create large-memory instances of Aspire.
      • The Aspire framework itself does not use up that much memory (100mb or so). But some applications may store big hash tables to improve performance, so it's best to have the 64 bit JVM (Java Virtual Machine), just in case you need it someday.
  2. Test that you can access the "java" command from your console.
    1. Open up a new DOS command-shell (go to the Start menu, enter "cmd" in the "Run" or "Search for Programs" field, and then execute the cmd.exe program).
    2. At the prompt, enter the following, then press the Enter key: java -version
    3. Success is indicated when version information is returned.
 > java -version
 java version "1.6.0_18"
 Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
 Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)

PART II: Install Eclipse

  1. Go to http://www.eclipse.org/downloads/ and install the latest version of Eclipse IDE for Java Developers.
    • Take care that your 32/64 bit choice matches the Java JDK you installed (or else Eclipse will fail to start with a JVM error of -1).
  2. Unzip it to the folder of your choice.
  3. Execute Eclipse.
    • Specify a folder where your workspace will be located (can be anywhere).
  4. Check to make sure your Eclipse is using the correct JDK version:
    1. Start Eclipse.
    2. Open Menu: Window/Preferences
    3. Go to Java/Installed JREs.
    4. Check that Java 6 (or later) is installed and selected.
      • Must specify the JDK 1.6 (not a JRE) AND select it; if not, add the new VM and then select it as the default.
      • This is required so that new Maven projects will build correctly.
      • When creating new Java projects, make sure that your JRE choice is "Use default JRE", which should be pointing to your JDK.
  5. Install the "Aspire Coding Profile" for Aspire coding standards: media:Aspire_Java_Coding_Profile.xml
    1. Open up Window / Preferences.
    2. Go to Java / Code Style / Formatter.
    3. Click "Import..."
    4. Locate the "Aspire Java Coding Profile.xml" file.
    5. Click "Apply".
      • All this does is set the indentation to 2 spaces (no other coding style issues are important).

PART III: Install subversion into Eclipse

  1. Inside eclipse, go to: Help / Install New Software...
  2. Under "Work with:" enter:
    • Eclipse Kepler (4.3): http://subclipse.tigris.org/update_1.10.x (has support for 1.8 SVN)
    • Eclipse Juno (4.2) might work better with: http://subclipse.tigris.org/update_1.8.x
    • Eclipse (3.5) might work better with: http://subclipse.tigris.org/update_1.6.x
  3. Mark all checkboxes and click Next.
  4. Review items and click Next.
  5. Accept the license, click Finish, and let it install.
  6. Restart Eclipse.
  7. Create a new SVN Repository Location by going to Window / Open Perspective / Other… and selecting SVN Repository Explorer.
  8. Right click inside the SVN Repositories window and select New / Repository Location.
  9. Enter the URL of your SVN repository as the "Url" and click Finish.
    • Search Technologies' employees should use https://svn.searchtechnologies.com/svn/aspire.
    • Community and Enterprise users DO NOT have access to the Search Technologies SVN repository and should use the appropriate URL for their SVN servers and repositories.
  10. The application will try to connect; if it connects successfully, you will be prompted for user and password (check the box to avoid being asked to login several times).
    • Search Technologies' employees should use their standard Search Technologies username and password.

Are you using a 64-bit JVM for Eclipse?

  • You may see "JavaHL" missing library errors when you go to your Subversion repository.
  • If this is the case, you may need to install a 64-bit version of "JavaHL". Go to http://www.sliksvn.com/en/download and download and install the "SlikSVN" 64-bit Windows subversion client. It should put the SlikSVN binaries on your Windows PATH environment variable (check this). Then restart Eclipse and you should be fine.
  • See http://subclipse.tigris.org/wiki/JavaHL for more details.

PART IV: Install Maven Into Eclipse (m2eclipse)

Install the plugin:

  1. Go to Help / Install New Software...
  2. Under "Work with" enter:
    • Eclipse Kepler (4.3): http://download.eclipse.org/technology/m2e/releases
    • For Eclipse Galileo (3.5): http://m2eclipse.sonatype.org/sites/archives/m2e-0.10.2.20100623-1649/
    • For Eclipse Helios (3.6) / Eclipse Indigo (3.7): http://m2eclipse.sonatype.org/sites/m2e
    • For the latest version of Eclipse: http://download.eclipse.org/technology/m2e/releases
  3. Click to install the following items:
    1. Maven Integration (the whole thing)
  4. Click Next/Finish/Accept/Restart as necessary to complete the installation.

Set Eclipse to use the jdk1.6.0_xx (this is recommended by m2eclipse):

    1. Edit the "eclipse.ini" file located in your eclipse directory.
    2. Add the following two lines to the top of the file:
      • -vm
      • C:\Program Files\Java\jdk1.6.0_xx\bin
        • (specify the exact location of your JDK-6 binary)

To test that m2eclipse is working correctly:

  1. Restart Eclipse.
  2. Open up the console window: Menu: Window / Show View / Console
  3. Look for the open-console toolbar (the console with a + sign), then select "Maven Console."
  4. Make sure there are no errors (any errors will be shown in red).
  5. Wait for it to download the maven repository index.

Optional (install additional plugins):

  1. Return to Help / Install New Software...
  2. After the "Work with:" prompt, enter: http://m2eclipse.sonatype.org/sites/archives/m2e-extras-20101029/
    • This is an older version 0.10. When the newer version has all the elements we need, it will be at: http://m2eclipse.sonatype.org/sites/m2e-extras
    • The missing element was "Maven SCM handler for Subclipse".
  3. Click to install the following items:
    1. Maven Optional Components / Maven SCM handler for Subclipse
    2. Maven Optional Components / Maven issue tracking configurator for Mylyn 3.x
    3. Maven Project Configurators / WTP

In order to get Maven to Run inside Eclipse, you will need to change the JRE to JDK 1.6:

  1. Window / Preferences
  2. Java / Installed JREs
  3. Add...
  4. "Standard VM"
  5. Click "Directory...", then locate your JDK folder, click on the JDK folder and then hit OK & Finish
  6. Back in the "Installed JREs" dialog, make sure your JDK is selected.
  7. Click OK.

PART V: Install Maven Command Line

Installing the Maven command line is a very useful way to work with Maven and projects, especially for distributions, or when you're having trouble with m2eclipse (which happens now and then).

  1. Download Maven from Apache Site: http://maven.apache.org/download.html
  2. Unzip/Untar Maven into the directory of your choice.
  3. Create two environment variables in your System Properties:
    • M2_HOME -> Maven directory path
      • (for example: C:\dev\apache-maven-2.1.0)
    • M2 ->  %M2_HOME%\bin
  4. Append the value ";%M2%" to your Path variable.
  5. Make sure your JAVA_HOME is set to your JDK version .
  6. Make sure your Path contains %JAVA_HOME%\bin.
  7. Test installation in 'cmd' window, as shown below:
 > mvn -v
 Apache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400)
 Java version: 1.6.0_14
 Java home: C:\dev\jdk1.6.0_14\jre
 Default locale: en_US, platform encoding: Cp1252
 OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

For detailed steps, please refer to Step 2 of the Aspire Quick Start with Distribution Archetype tutorial.

PART VI: Install Cygwin with Subversion Command-Line

If you are running in Windows, then Cygwin is an extremely valuable tool for managing very large files.

  1. Go to http://www.cygwin.com/ and install the Cygwin setup.exe program
  2. Run the setup.exe program, then follow the instructions.
    • Install cygwin into C:\cygwin.
    • Make sure that Subversion is selected when installing packages.
      • In the 'Devel' category, make sure that "subversion: A version control system" is selected.
  3. Once installed, add the following environment variables to your Windows environment:
    • Go to Control Panel / System / Advanced System Settings / Environment Variables...
    • Add variables for:
      • CYGWIN => nodosfilewarning
      • Add ";C:\cygwin\bin" to the end of your PATH variable.
        • This will allow all cygwin commands to be executed directly from DOS Command windows.