Setup For Labs¶
To be prepared for the labs, you'll need the following installed on your machine:
- Java 17 (or later)
- git 2.36 (or later)
- IntelliJ IDEA 2022.3 (or later) Community or Ultimate Editions
- or Eclipse (if you must, however all course examples will use IntelliJ IDEA)
A. Fork the Repository¶
The starter repository can be found on GitHub. In the top-right corner of the page, click the Fork button to create your own copy of the repository.
On the Create Fork page, select the appropriate owner (1) (which is probably just your GitHub username), and leave the Repository Name (2) as-is. (You're welcome to change it, of course, but if you do, you may find future instructions confusing.)
Then click the Create Fork button (3)
After GitHub does its work, you'll see something like:
Click on the Code dropdown button (1) and copy the git
link (SSH is preferred) to the clipboard (2).
B. Open the Project in IntelliJ IDEA¶
IntelliJ IDEA
These instructions are for IntelliJ IDEA.
If you're using another IDE, clone and open the project via the Maven pom.xml
file as appropriate.
-
Launch IntelliJ IDEA and click on the Get from VCS button (1).
If you don't see the "Welcome" dialog, then click the Git menu and select Clone...
-
Paste the link you copied to the clipboard from step A into (1). Make sure the project name (
blackjack-r2ha-2022
) is at the end of the Directory (2). Then click Clone (3). -
If all goes well, the project should open, IntelliJ IDEA will scan and set up the project according to the Maven
pom.xml
file. This may take a few minutes to download the project dependencies.
C. Set "Upstream" for Tags¶
As the lab exercises build upon previous ones, I use git "tags" to mark starting points for each lab and the solutions. For this to work on your fork, you need to be able to fetch the tags from the main repository by setting git's upstream
remote for your copy of the repository. You can do this through IntelliJ IDEA's git support, or on the command-line.
IntelliJ IDEA Git¶
With your project loaded, select Manage Remotes...
from the Git
menu:
On the Git Remotes
dialog, click the +
to add a new remote:
Type upstream
for the name of the remote, and for the URL, use https://github.com/tedyoung/blackjack-r2ha-2022
:
You should then see two remotes:
Finally, use Git Fetch to download the tags from the upstream repository:
Command-Line Git¶
Type the following to set the upstream
git remote to the main repository:
Then to get the tags that I've defined into your local copy, do:
D. Run the Tests in IDEA¶
-
Once the indexing completes, open the Project window on the left side and right-click on the
src > test > java
directory (1) and select Run 'All Tests' from the menu (2): -
The test results will show up in a bottom window pane and should be green (all the tests should pass):