-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add importing gradle project for vscode #87
Changes from 2 commits
d2ddd29
96e10fc
e549c86
70a2c63
1babe7b
32cda49
87a1c23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,56 @@ | |
This page contains **'community resources' contributed by students**. | ||
</box> | ||
|
||
Coming soon ... | ||
## Importing a Gradle project | ||
|
||
<box type="tip" seamless> | ||
|
||
If the project comes with Gradle support, you will see a build.gradle file in your project root. | ||
</box> | ||
|
||
<box type="warning" seamless> | ||
|
||
Install the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) extension to enable support for Java extensions. | ||
Go to `Extensions` → Search `Extension Pack for Java` → Install. | ||
</box> | ||
|
||
1. Open Visual Studio Code. | ||
|
||
2. If you are in the welcome screen, Click Open. Otherwise, click File -> Open. | ||
i. Select the project directory, and click Open. | ||
|
||
3. Confirm the correct Java version is being used for Gradle, as follows: | ||
|
||
(a) Confirm the project JDK is set to the one you are supposed to use for the project, as given in the panel below: | ||
|
||
i. Open the Command Palette by pressing `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (Mac). | ||
|
||
Comment on lines
+36
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a nice touch that personalises to the reader and makes it more convenient! |
||
ii. Type "Java: Configure Java Runtime" and select it. | ||
|
||
iii. Check that the JDK version matches the one required for your project. If not, you can install the required JDK and configure it. | ||
ruishanteo marked this conversation as resolved.
Show resolved
Hide resolved
ruishanteo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
**Note:** MacOS users need to download Azul Zulu compatible with their machine and Java 17, with the Java Package specified as JDK FX. | ||
|
||
(b) Confirm the correct JVM is used for Gradle, as given in the panel below: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can quickly define JVM (or just spell out first) as the context doesn't provide much of a hint to first-time Java users? |
||
|
||
<panel header="VSCode: Setting the JVM for Gradle"> | ||
|
||
1. Install the Gradle Extension: Search for "Gradle" in the Extensions view (`Ctrl+Shift+X`), and install a Gradle extension if you haven’t already (e.g., Gradle for Java). | ||
ruishanteo marked this conversation as resolved.
Show resolved
Hide resolved
ruishanteo marked this conversation as resolved.
Show resolved
Hide resolved
ruishanteo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
2. Open settings.json: You can find it by opening the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`), then typing "Preferences: Open User Settings (JSON)". | ||
3. Add or modify the following settings to configure the JVM for Gradle: | ||
|
||
``` | ||
{ | ||
"java.configuration.runtimes": [ | ||
{ | ||
"name": "JavaSE-17", | ||
"path": "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home" | ||
} | ||
], | ||
"java.import.gradle.java.home": "/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home" | ||
} | ||
ruishanteo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
ruishanteo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</panel> | ||
|
||
4. After the importing of the project is complete (which could take a few minutes), you will see the Gradle Tab in the VSCode interface e.g., look for the elephant icon on the left and click it. | ||
ruishanteo marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the intended step-by-step approach to indicate opening a file. However, when I first read it, I was slightly confused with all the 'Open's. Perhaps for just opening the project, we could tell the reader to "Open your project via Open Folder or File -> Open. Then select your project folder and click open." rather than have a (i) point for it.