10 April 2012

Eclipse SVN Setup

Requirements

  • Eclipse IDE for Java EE developers
    • with Subversive plugin
  • Tomcat 6 binary distribution (or what's on production)
  • Java 1.6 (or what's on production)

Environment Setup

  • Setup eclipse
    • Setup the Installed JREs
      • Window > Preferences > Java > Installed JREs. Select Add if a JRE is not yet configured.
      • Select Standard VM in the JRE Type window and click Next.
      • Populate the JRE Home field with the location of your Java installation.
    • Setup Server Runtime Environment.
      • Window > Preferences > Server > Runtime Environments. Select Add if a Tomcat Server is not yet configured.
      • Select Apache > Apache Tomcat v.6.0 in New Service Runtime Environment. Click Next.
      • Set the Tomcat installation directory to the location of the Tomcat binary distribution folder.
      • Select the right JRE.
  • Check out the customer project
    • Open the SVN Repository Exploring Perspective (Window > Open Perspective > SVN Repository Exploring)
    • Right click on the SVN Repositories view > New > Repository Location...
    • Enter https://svn.... in the URL field and enter in Authentication info.
    • A new repository location should appear in the SVN Repositories view. Right click the repository and select Check Out.
      • This action will checkout the project into your workspace.
    • Once done, return to the Java EE perspective and ensure a new project named "customer-portal" is in your Package Explorer (or Project Explorer) view.
  • Exclude Eclipse resource files (.settings folder, .project file, .classpath file) and /build folders from SVN to prevent from being checked in (especially the /build folder).
    • First, determine if you can see the resource files by expanding the customer-portal project. If you can see them, skip the next step.
    • If you cannot see the resource files, in the Package Explorer view, click on the View Menu button (it's a white arrow pointing down, next to the package explorer's Collapse All, Link with Editor, Minimize, Maximize controls), and select Resources...
      • Deselect .*resources from the Select the elements to exclude from the view box.
      • Click OK. The resources files should now appear in the package explorer view
    • Select the three resource files (.settings folder, .project file, .classpath file) and right click > Team > Add to svn:ignore...
    • Select OK.
    • Do the same for the /build folder (if it does not exist yet, create the folder "build" in the root of the customer-portal project).
      • A question mark should appear in the folder indicating that it's not version controlled.
      • Right click the folder > Team > Add to svn:ignore. Click OK.
  • Load the project's build file
    • Open the Ant view by selecting Window > Show View > Ant
    • Expand the customer-portal project and locate build.xml file
    • Drag and drop the build file onto the Ant view.
    • The build file should now appear in the view, which once expanded shows a list of all tasks in the build file.
  • Confirm the environment is setup correctly by running sandbox-war or production-war, and that the war files appear under /build (a refresh F5 might be needed to show the folders).