- Familiarize yourself with git by completing this interactive tutorial in your browser.
- Install git on your machine.
- Mac: Open
Terminal.app
and install the Apple Developer Tools by executingxcode-select --install
. - Linux: Use your distribution's package manager to install git; on Ubuntu, you'll run something like
$ sudo apt-get update $ sudo apt-get install git
- Windows:
You should not use Windows, use Ubuntu on VirtualBox instead.Download and install the Windows installation package; make sure to install (and use) git bash.
- Mac: Open
- Try git in the real world:
- Sign in or create an account on Github (it's free, and you should already have one...).
- Create a new repository (note: with a free account, your're limited to public repos); select Initialize this repository with a README to add a
README.md
file. - On your computer, clone your new repository, edit the
README.md
to your choice, using the Github markdown cheatsheet. - Add/stage and commit the changes, and push them to your repository.
- Create and switch to a new branch (eg.
feature/add-license
), and add a fileLICENSE
to it, containing the MIT open source software license. Not sure where to find it? Try this link. For a real project, you may want to chose a different license (read more about licenses here: https://opensource.org/licenses). - Push the branch; you should now be able to see it on Github.
- On Github, create a pull request and merge it to master.
- Back on your computer, checkout
master
, and pull the changes to update your local copy.
Note: Since you'll be working on assignments together, it's a good idea to fork the official assignment repository, add your friend as a collaboratoer, and take it from there!
You should now know what it means if someone asks you: Can you please merge my PR into your master branch?
- Install the Gradle build tool; make sure you have a recent Java JDK installed and configured for command line use.
- Familiarize yourself by completing the Java application tutorial. Note: This requires a command line shell, such as bash. If you're running Windows, you can use git's bash, try Cygwin, or use Ubuntu on VirtualBox.
Note: Using the gradle wrapper is generally advised.
You should now know how to read a basic
build.gradle
file, and whatgradle build
means.
- Make sure you have the latest IntelliJ IDEA installed (it's free for educational use!).
- On first launch, you may have to configure the default project structure and check your installed/configured JDKs: You may also have to configure the location of Gradle, if not automatically configured.
- Select Check out from Version Control: git and provide the repository URL; note that you can use either
https://hsro-inf-...
(and provide your Github username and password), or[email protected]:hsro-inf-...
(with SSH credentials as configured with Github). - After checkout, it may take a while for Gradle to build and index the project.
- Look at the project's
build.gradle
and see how it configures for the use of JUnit 5. - Look at the class
fhro.inf.prg3.a01.MyExampleClass
and read the javadoc comments. What is it's (very simple) purpopse? - Look at the test class
fhro.inf.prg3.a01.MyExampleClassTest
and run the tests. - Fix
MyExampleClass
so that all test cases pass.
Note: We will go into details with
import static
and@...
later, but go ahead and google what they do!
The original repository has Tracis CI integration enabled (see .travis.yml
).
On each push event, it will run a build process, which includes executing all tests.
If one test fails, the build fails, which can help prevent merging in bugs from other branches or forks.