Skip to content

GettingStartedEclipse

andrewbyrd edited this page Sep 30, 2011 · 58 revisions

First, make sure you are using the latest version of Eclipse, available at http://eclipse.org/downloads/. If you plan on doing development work on the OpenTripPlanner web interfaces (either the REST API or the user webapp), it might be helpful to download the "Eclipse IDE for Java EE Developers" flavor of Eclipse (rather than the "Eclipse IDE for Java Developers"), as it includes many of the necessary plugins for webapp development.

Many things have changed in the Indigo release, including Maven integration and the "marketplace" system for installing connectors. OTP has been updated accordingly, and you may run into incompatibilities when using older versions of Eclipse.

Eclipse 3.7 (Indigo) includes:

  • eGit - an "Eclipse team provider" (i.e. version control system plugin) for Git
  • m2eclipse - adds Maven support to Eclipse, for editing project models and (automatically) run builds

OTP is versioned using Git, and its build process and dependencies are managed by Maven, so these built-in components will be useful. There are a few other Eclipse components that you may need:

If you want to work on the web interfaces or run OTP on a Tomcat server from within Eclipse, you will also need to install Eclipse Web Tools Platform (WTP) and "Maven Integration for Eclipse WTP". Using the "Eclipse Marketplace" (available from Eclipse's Help menu) search all markets/all categories for "WTP", and the Maven Integration should be among the first items in the list.

(TODO image: ss_marketplace_maven_wtp.png)

WTP and Web Standards Tools subproject (WST) should also be installed as dependencies.

Checking Out the Source from Git

Switch to the "Git Repository Exploring" perspective in Eclipse by selecting Window -> Open Perspective -> Git Repositories (if you don't see this option under Open Perspective, choose Window -> Open Perspective -> Other... and select Git Repository Exploring). Click on the "Clone a Git Repository and add clone to this view" button as shown below:

image

Enter git://github.com/openplans/OpenTripPlanner.git for the URI, select "HTTPS" for the protocol. If you want to contribute edits back, you'll need to enter your GitHub username and password here too, as shown below:

image

Click Next, then select all branches (although the 'master' branch is probably what you're interested in). Click Next, then select the directory where you want the code to be checked out to. Then click Finish. Be patient, it will take Eclipse a minute or two to download the source to your computer, and then the OpenTripPlanner repository should appear in the "Git Respositories" panel.

Importing Existing Source into Eclipse

You can easily import the OpenTripPlanner source into Eclipse. Under the menu option "File -> Import", browse to the "General -> Maven Projects" element:

image

Browse to the root folder of the source tree and then select all the projects of interest:

image

The Result

When everything works correctly, you should see each OpenTripPlanner maven module checked out as an individual Eclipse project in your workspace:

Note that on initial checkout, it may take a while to initially build all the projects in your workspace. In the background, the Maven plugin is downloading all the project dependencies (there are a quite a few). This bulk download only happens once.

image

What Next?

You might look at:

  • GraphBuilder -- you need to build a graph from your transit data.

  • -- then you need to serve the webapps

Having Problems?

  • Check out our page
Clone this wiki locally