Skip to content

Developing LARS in Eclipse

ashleyrobertson edited this page Dec 8, 2015 · 17 revisions

Creating an Eclipse workspace for LARS development

Make sure you have the following prerequisites installed: (older or newer versions may work but this is what we've tested with)

Although you can build, run and test LARS using Gradle, it's also possible to develop LARS using Eclipse. These instructions guide you through the process of creating a LARS development environment in Eclipse.

  • Get Eclipse IDE For Java Developers from http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/lunasr2. At the time of writing, we are using Eclipse Luna SR2 (4.4.2).

  • Install the Buildship Gradle Integration plugin for Eclipse from http://marketplace.eclipse.org/content/buildship-gradle-integration

  • Clone the LARS git repository in Eclipse (if you haven't already cloned the repository through another method)

    • Open the Git perspective (Window -> Open Perspective -> Other... -> Git)
    • In the toolbar of the Git Repositories view, click the button to "Clone a git repository"
    • Fill out the fields in the wizard
      • The URI for the main LARS repository is https://github.com/WASdev/tool.lars.git, this will then fill in most fields for you
      • The username and password are your github credentials. Note that if you use two-factor authentication, you will need to create a Personal Access Token and use that as your password, or use SSH keys instead.
      • On the next page, choose to clone all branches
      • On the next page, make a note of the destination directory, you'll need it for the next step
      • Do not select "Import all existing Eclipse projects after clone finishes" - we need to import the projects as Gradle projects, not as existing eclipse projects.
  • Import the LARS projects into Eclipse:

    • File -> Import -> Gradle -> Gradle Project
    • Give the root directory of your tool.lars source tree and click Next
    • Select the root project (tool.lars) in the resulting tree to select all projects
    • We don't (yet) have a Gradle wrapper, so you'll need to point to an existing install or select a Specific Gradle Version and use "2.5"
    • If you need to specify a particular version of Java, you may set the Java home directory
    • Click Next and then Finish

Note: at this point you will have errors in your workspace because some dependencies are provided by the liberty installation.

  • Configure the location of liberty and mongodb on your system

    • Switch back to the Java perspective
    • In the package explorer, open /server/gradle.properties
    • Set libertyRoot to point to the wlp directory of your liberty installation
    • Set mongodExecutable to point to the mongod executable (named mongod.exe on Windows)
  • Run a Gradle refresh to pick up the changes

    • Select all projects -> Right-click -> Gradle -> Refresh Gradle Project
  • Build and test the code

    • Open the Gradle Tasks view (Window -> Show view -> Other... -> Gradle -> Gradle Tasks)
    • Double click on tool.lars/build
Clone this wiki locally