System Setup
Installing Git, generating SSH keys, and configuring IntelliJ.
Table of contents
There’s a lot to setup, and it can be frustrating if things aren’t working. Setup can be a bit finicky because different computers behave in different ways. This setup procedure is fairly tedious, but luckily we only need to do it once and it’ll save us time for future homework assignments.
If something doesn’t look right, come to Drop-In and we can work together to figure it out. You can also let us know about any problems by making a new Piazza question.
- Tip
- The more relevant details we can get about the problem, the better. Include the setup step that’s causing trouble, a summary of the problem, as well as what you expected to see. A screenshot can also be helpful.
Java
All of the homeworks in this course will use Java JDK 11. If your computer already has JDK 11 (or newer), then you can skip this step.
Windows/macOS
Install OpenJDK 11 (LTS) with HotSpot through AdoptOpenJDK.
Linux/BSD
Grab JDK 11+ (not JRE) from your favorite package manager / ports tree.
AdoptOpenJDK also has pre-built .deb and .rpm files, if you can’t get it as a package.
Git
Git is a version control system (VCS): a tool for tracking changes between versions of code and sharing those changes with other people. A VCS allows us to not only see changes from old code, but also revert back to older versions and manage many different team members contributing to a project at the same time. All of this information about our code and its history is stored together in one unit called a repository (repo). It’s a data structure that represents all of our work.
You may have heard of GitHub before. GitHub is an online platform for storing and managing backups of our Git repositories.
In this course, we will be using CSE GitLab, a CSE-supported alternative to GitHub. While your Git repository works locally, keeping it backed up on CSE GitLab not only makes it convenient to find past versions of your work in case your computer crashes, but it also simplifies the process for turning in homework.
macOS
macOS generally comes with Git included, but sometimes there might be an extra download step.
From Finder, navigate to Application – Utilities – Terminal. Type git
into the terminal and hit Enter. If you get a download prompt, follow the prompt. Otherwise, you will see a help message if git is successfully installed.
Windows
Windows users must download and install Git manually. You can grab the latest version from Git’s official Windows release download page and follow the installation wizard afterwards.
All of the default settings are acceptable for this course. You can choose different settings if you have a particular preference. If you do intend to change any preferences, make sure to leave Configuring the line ending conversions to the default option, Checkout Windows-style, commit Unix-style line endings, to ensure compatibility with our Linux-based (Unix-style) autograders.
Linux/BSD
Users of Unix-like operating systems can generally install git
from their package manager (the package is usually just named git
).
SSH Keys
You will need to generate SSH keys to use the CSE GitLab. SSH keys fill the same role as a username and password: we use them to authenticate our digital identity with a service. SSH keys can be thought of as very long, randomly generated, unique identifiers that serve as both your username and your password. Many programming tools prefer to use SSH keys because they are extremely difficult to be guessed or broken.
Since SSH keys are very long, we don’t actually type in SSH keys with a keyboard. Instead, your computer will store your SSH key and automatically send it to a service when you need to authenticate. When all setup, authenticating with SSH keys are usually faster than using a username and password because you don’t need to enter the details every time.
Generate a new SSH key pair
If you already have an SSH key pair, you can use that if you prefer.
- Open a terminal on *nix or macOS, or Git Bash on Windows (which comes with the Git installation).
- Generate a new ED25519 SSH key pair:
ssh-keygen -t ed25519
- Next, you will be prompted to input a file path for your SSH key pair. Accept the defaults by pressing Enter on your keyboard.
- Once the path is decided, you will be prompted to input a password to secure your new SSH key pair. It’s a best practice to use a password, but it’s not required and you can skip creating it by pressing Enter twice.
Add the SSH key to your GitLab account
- Copy your public SSH key (from your home directory,
.ssh/id_ed25519.pub
). You can view the contents of a file from the terminal:cat ~/.ssh/id_ed25519.pub
- Visit your CSE GitLab account at gitlab.cs.washington.edu.
- Navigate to the SSH Keys by tapping on your avatar in the upper right corner and selecting Settings. Paste your public key into the Key field. Give it a title if it doesn’t have one already. Then, tap Add key.
IntelliJ
IntelliJ is the integrated development environment (IDE) that we’ll be using in this course. If you’ve used jGRASP before, IntelliJ is its real-world, production-ready equivalent.
Download and install IntelliJ Community Edition. Open IntelliJ after installation is finished. During the first startup, IntelliJ will ask you to configure some editor settings. You can Skip Remaining and Set Defaults, or choose a color scheme and continue.
After the initial setup steps are complete, you’ll be greeted by the welcome window. In the “Welcome to IntelliJ IDEA” window, tap the Configure dropdown in the bottom right corner and choose the Plugins menu item. From the “Plugins” window, we’ll install two plugins: Checkstyle-IDEA and Java Visualizer. After installing the plugins, restart IntelliJ.
Getting Your Repository
Now that the initial IntelliJ setup is done, we can download a copy of the homework by cloning your personal CSE GitLab repository.
First, let’s make sure that you have access to your personal repository. Visit GitLab, and you’ll be greeted by two repositories: skeleton
, and a repository named after your UW NetID. This named repository is your personal repository. Your personal repository should already have some files and folders inside including the skeleton code for the first homework assignment, intlist
.
Tap the blue Clone button and copy the Clone with SSH Git address. This should look like the following address except named after your UW NetID.
git@gitlab.cs.washington.edu:cse373-20wi-students/YOUR_UW_NETID.git
In the IntelliJ welcome window, tap on the Get from Version Control. Paste the Git address from earlier and choose a directory to store your personal repository. Once IntelliJ finishes cloning your repository, a new window will ask if you want to create or import a new project from this repository. Tap Yes to accept. You should see the IntelliJ main editor shortly.
Configuring Gradle
Gradle is a neat Java build system that downloads dependencies and configures your environment for you. In CSE 373, we will a maintain configuration file for you. We want to configure Gradle to always use our newest configuration files as homeworks gradually get released.
To do this, open the Settings dialog (IntelliJ IDEA – Preferences on macOS, File – Settings everywhere else). Then, navigate to Build, Execution, Deployment – Build Tools – Gradle. You should check the checkbox that reads Automatically import this project on changes in build script files:
Configuring Checkstyle
We’ll need to setup the Checkstyle plugin with CSE 373-specific settings.
Still in the configuration window, tap on the Checkstyle item at the bottom of the sidebar. From here, we have a few things to do.
- Make sure the Checkstyle version selected is 8.24 or greater.
- Change the Scan Scope dropdown in the top right to Only Java sources (including tests).
Add the CSE 373 checkstyle configuration. Tap the + icon on the right side under Configuration File section. In the window that appears, enter a description like “CSE 373 Checks”. Then, make sure select Use a local Checkstyle file is selected and paste in the following path:
config/checkstyle/checkstyle.xml
(It doesn’t matter whether you enable the option for Store relative to project location—that only affects how the file is stored, and not where it’s found.)
- Back in the Checkstyle settings, mark the checkbox next to “CSE 373 Checks” (or whatever name you chose) to enable it. Finally, tap OK to apply the updated settings.
Phew, that’s it! What’s next?
Follow the Using IntelliJ quick start guide to introduce yourself to the software we’ve just installed.