This is a project template for a small CLI Java project. It uses Gradle for build automation and GitHub Actions for CI.
Prerequisites: JDK 11, update Intellij to the most recent version
- Open Intellij (if you are not in the welcome screen, click
File
>Close Project
to close the existing project dialog first) - Set up the correct JDK version
- Click
Configure
>Structure for New Projects
and thenProject Settings
>Project
>Project SDK
- If JDK 11 is listed in the drop down, select it. If it is not, click
New...
and select the directory where you installed JDK 11 - Click
OK
- Click
- Click
Import Project
- IMPORTANT: Locate the
build.gradle
file in the project directory, select it, and clickOK
- If there are any further prompts, accept the defaults.
- After the set up is complete, you can locate the
src/main/java/seedu/duke/Duke.java
file, right-click it, and chooseRun Duke.main()
. If the setup is correct, you should see something like the below:Type some word and press enter to let the execution proceed to the end. Also note how Intellij is now using Gradle to run your code (you can make Intellij run the code without Gradle this way).> Task :compileJava > Task :processResources NO-SOURCE > Task :classes > Task :Duke.main() Hello from ____ _ | _ \ _ _| | _____ | | | | | | | |/ / _ \ | |_| | |_| | < __/ |____/ \__,_|_|\_\___| What is your name?
This project is already configured to use Gradle. Read the following tutorial to learn how to use gradle to do tasks such as running tests, checking code against teh style rules, and generating the JAR file.
To run I/O redirection tests (aka Text ui tests), navigate to the text-ui-test
and run the runtest(.bat/.sh)
script.
To run JUnit tests (after you have added JUnit tests), you can run the test
Gradle task.
The project is already configured to use GitHub actions. When you push a commit to your fork or PR against an upstream repo, GitHub actions will run automatically to build and verify the product.