Object Oriented Programming Essentials

Handling Gradle Projects in IntelliJ

This course will require you to solve many questions, and instead of using a coding widget, we will provide you with compressed project files or git repositories. Here are the steps you need to follow:
Download or Clone the Project
If it is a git repository: Clone the Project:
Clone the project in your system
Open the project in your IntelliJ
If it is a compressed file: Download and Extract Projects:
Download the compressed projects.
Extract them and open the projects in your IntelliJ.
Gradle Projects:
These projects were built using Gradle. You don’t need to worry about Gradle for now. Just ensure you are not facing any errors.
Common JDK Error:
The most common error you might face is related to the JDK while building the project for the first time. Your IntelliJ might throw an error like this: ​
image.png
Identifying the Error:
In the highlighted section, it shows that the Gradle JVM option is incorrect.
If you do not see this issue, you are good to go. But if you do face the issue, follow these steps:
Fixing the Gradle JVM Issue:
Click on 'Open Gradle Settings', highlighted in blue. IntelliJ will open the settings UI, which looks like this: ​
image.png
Under the 'Gradle' section (already highlighted), you can see 'Gradle JVM'.
Click on the version drop-down menu to open a menu like this: ​
image.png
Selecting the Correct JDK:
In this drop-down menu, select your default OpenJDK, which you installed when learning Java fundamentals.
Ensure the JDK version is 17.
After selecting the JDK, click 'OK' and then 'Apply'.
Configuring the project:
Wait patiently for the Gradle project to configure. You don't have to do anything. Gradle will take care of it. The process will look like this: ​
image.png
This configuration might take some time:
Don't worry if this build is taking time. It is normal. After the downloading is completed, you will see it like this:
image.png
Building the Project:
Once the progress completes, open the IntelliJ terminal and run the command: ./gradlew clean. ​
image.png
Ensure you are in the root folder of your project before running the command and then press enter.
Successful Build:
If everything goes well, you will see the message BUILD SUCCESSFUL like this: ​
image.png
Ready to Go:
After seeing the successful build message, you are good to go!
You can now start solving the problems.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.