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
File
> Close Project
to close the existing project dialog first)Configure
> Structure for New Projects
and then Project Settings
> Project
> Project SDK
New...
and select the directory where you installed JDK 11OK
Import Project
build.gradle
file in the project directory, select it, and click OK
After the set up is complete, you can locate the src/main/java/seedu/duke/Duke.java
file, right-click it, and choose Run Duke.main()
. If the setup is correct, you should see something like the below:
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :Duke.main()
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
What is your name?
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).
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.