CSE 373, Autumn 2018: Eclipse project loading guide

Opening a new project

This section of the guide covers how to open a class project in Eclipse. It is very important that you DO NOT simply open the class project: instead, you must import the project as a git and gradle project.

You should also make sure you're connected to the internet when performing these steps. When you're importing the project, Eclipse will automatically try and download some libraries you need to run your code.

  1. First, download and unzip the project from the class website. You can find the download link on project specs page.

  2. Run Eclipse. Select the "File" > "Import" option from the menu:

  3. Select the "Gradle" > "Existing Gradle Project" option.

  4. Hit "Ok" and "Next" until you encounter the below dialog. Click the "Browse" button:

  5. Navigate to where your project is located and select it.

    IMPORTANT: when you unzip the project files, you may end up creating two nested folders, both named "project1". When selecting your project, be sure to pick the innermost folder – that is, pick the folder that contains the "src" folder, the "build.gradle" file, etc...

    For example:

What is a 'gradle project'?

Note: this box contains optional background information: you do not need to know any of the information presented here.

When working on larger projects, programmers tend to face a few different problems:

  1. How do you keep track of what 3rd party libraries the project needs installed?
  2. Each IDE stores its project config in a slightly different way. How can you make sure your project can run on all kinds of different IDEs, including ones you've never heard of, with minimal fuss?
  3. Sometimes, building our project and producing a final JAR we can give to our users can require running multiple instructions/performing several complex steps. Instead of having to do that manually, can we just write a script that does this all automatically for us?

It turns out that we can use the same tool to answer all of these questions: we can use a build manager. Basically, what happens is that we record all of the libraries we need, all project configuration, and all build instructions inside of a special file our build manager understands.

Conveniently, it also turns out that all (modern) IDEs have great support for a wide variety of popular build managers: they can read the special file and automatically convert all of those instructions into their IDE-specific configuration.

In our case, we're using a build manager called "gradle". Try opening up build.gradle inside of your project. If you skim through it, you can see that the file configures a variety of things and specifies a handful of 3rd party libraries we want to install and use. (We've commented this file fairly heavily in case you're curious).

Gradle isn't the only build manager – other popular build managers for Java include Ant, Maven, and Ivy.

If you start working with other programming languages, you'll learn that they all also have their own build managers and conventions for managing large projects. However, at a high level, they all work in the same way: you specify the libraries you need and your build instructions in some file(s), and run some sort of build tool to manage everything for you.