Skip to content

Commit b7472f1

Browse files
Katie Horneericpaulsen
Katie Horne
andauthored
chore: add getting started guide featuring IntelliJ (coder#936)
* Add content to IntelliJ guide * chore: update manifest and index * chore: fix formatting * chore: edit text * fix: typo Co-authored-by: Eric Paulsen <ericpaulsen@coder.com>
1 parent a175f29 commit b7472f1

File tree

4 files changed

+169
-0
lines changed

4 files changed

+169
-0
lines changed
Loading

getting-started/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ Coder.
2727
Additionally, we have a guide for those interested in leveraging Coder for
2828
[data science](data-scientists.md), specifically using Python with Jupyter
2929
notebooks. We also have a tutorial on getting started with [PyCharm](pycharm.md)
30+
and [IntelliJ](intellij.md).

getting-started/intellij.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
---
2+
title: IntelliJ
3+
description: Get started with Coder as an IntelliJ user.
4+
---
5+
6+
This article will walk you through getting started with a Coder workspace and a
7+
project that leverages IntelliJ. You'll learn how to:
8+
9+
- Connect Coder to your Git provider;
10+
- Create a workspace;
11+
- Create an IntelliJ project;
12+
- Push your changes to GitHub.
13+
14+
## Prerequisites
15+
16+
This guide assumes that you have a Coder deployment available to you and that
17+
you have the credentials needed to access the deployment.
18+
19+
## Step 1: Log in and connect Coder to your Git provider
20+
21+
You'll log into Coder in this step and connect and authenticate with your Git
22+
provider. This will allow you to do things like pull repositories and push
23+
changes.
24+
25+
1. Navigate to the Coder deployment using the URL provided to you by your site
26+
manager, and log in.
27+
28+
1. Click on your avatar in the top-right, and select **Account**.
29+
30+
![Set account preferences](../assets/getting-started/account-preferences.png)
31+
32+
1. Provide Coder with your SSH key to connect and authenticate to GitHub.
33+
34+
If your site manager has configured OAuth, go to **Linked Accounts** and
35+
follow the on-screen instructions to link your GitHub account.
36+
37+
![Link GitHub account](../assets/getting-started/linked-accounts.png)
38+
39+
If your site manager has _not_ configured OAuth, go to **SSH keys**. Copy
40+
your public SSH key and
41+
[provide it to GitHub](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).
42+
43+
![Add SSH key](../assets/getting-started/ssh-keys.png)
44+
45+
## Step 2: Create your workspace
46+
47+
You will now create the workspace to work on your development project.
48+
49+
1. Return to **Workspaces** using the top navigation bar.
50+
51+
1. Click **New workspace** to launch the workspace-creation dialog.
52+
53+
1. Provide a **Workspace Name**.
54+
55+
1. In the **Image** section, click **Packaged** (this tab contains
56+
Coder-provided images hosted in a Docker registry). Select **IntelliJ**. This
57+
will populate the form in the **Import** tab.
58+
59+
1. Under **Workspace providers**, leave the default option (which is
60+
**built-in**) selected.
61+
62+
1. Expand the **Advanced** section. If the **Run as a container-based virtual
63+
machine** option is selected, _unselect_ the box. Leave the **CPU**,
64+
**Memory**, **Disk**, and **GPU** allocations as-is.
65+
66+
1. Scroll to the bottom and click **Create workspace**. The dialog will close,
67+
allowing you to see the main workspace page. You can track the workspace
68+
build process using the **Build log** on the right-hand side.
69+
70+
![Create a workspace](../assets/getting-started/create-workspace-intellij.png)
71+
72+
Once your workspace is ready for use, you'll see a chip that says **Running**
73+
next to the name of your workspace.
74+
75+
## Step 3: Create a sample project file in your workspace
76+
77+
Once you've created your workspace, you can start working in Coder. For the
78+
purposes of this article, we'll leverage JetBrains' tutorial on how to
79+
[Create and run your first Java project](https://www.jetbrains.com/help/idea/creating-and-running-your-first-java-application.html).
80+
81+
1. Under **Browser applications**, click **IntelliJ IDEA Community** to open the
82+
IDE in your browser. Follow the prompts to accept the license agreement and
83+
determine data sharing permissions.
84+
85+
1. If the welcome screen opens, click **New Project**. Otherwise, open the main
86+
menu, and select **File** > **New Project**.
87+
88+
1. Under Project SDK, select Download SDK, leave the pre-filled fields as-is,
89+
and click **Download**.
90+
91+
1. Click **Next**.
92+
93+
1. Click **Next** again since you will not be creating a project from a template
94+
95+
1. Name your project `HelloWorld`, and click **Finish**.
96+
97+
1. In the Project tool window, right-click the **src** folder, then select
98+
**New** > **Java Class**.
99+
100+
1. In the **Name** field, enter `com.example.helloworld.HelloWorld` and click
101+
**OK**. The IDE will create the `com.example.helloworld` package and the
102+
`HelloWorld` class.
103+
104+
1. Update your code so that it looks like the following:
105+
106+
```java
107+
package com.example.helloworld;
108+
109+
public class HelloWorld {
110+
public static void main(String[] args) {
111+
System.out.println("Hello, world!");
112+
}
113+
}
114+
```
115+
116+
1. Click the **green triangle** to the left of your code. In the pop-up that
117+
appears, select **Run 'HelloWorld.main()'**. IntelliJ will begin compiling
118+
your code.
119+
120+
When IntelliJ is done compiling your code, it opens a new pane at the bottom
121+
that displays the result of running your code.
122+
123+
## Step 5: Push your repo to GitHub
124+
125+
The following steps show you how to push your app to a newly created GitHub
126+
repo.
127+
128+
1. Log in to GitHub and navigate to
129+
[Create a new repository](https://github.com/new).
130+
131+
1. Provide a **repository name** and click **Create repository**.
132+
133+
1. Return to your workspace, and click **Terminal** at the bottom.
134+
135+
1. Run the following to turn your directory into a Git repository and commit
136+
your initial changes:
137+
138+
```console
139+
cd ..
140+
git init <nameOfDirectory>
141+
cd <nameOfDirectory>
142+
git add -A
143+
git commit -am "Initial commit"
144+
```
145+
146+
1. Run the following in your terminal to add a remote to your GitHub repo,
147+
change the primary branch name to `main`, and push the contents to your newly
148+
created repo:
149+
150+
```console
151+
git remote add origin git@github.com:<username>/<repoName>.git
152+
git branch -M main
153+
git push origin main
154+
```
155+
156+
1. Within the IDE window (near the top), you'll be prompted to log in to GitHub
157+
by providing your username and password/personal access token.
158+
159+
1. Next, Code Web will display an alert that says the GitHub extension wants to
160+
sign in; click **Allow** to proceed.
161+
162+
1. In the subsequent window, click **Continue** to authorize Visual Studio Code
163+
to access GitHub.
164+
165+
At this point, the contents of your repo should be pushed to GitHub.

manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
{
4141
"path": "getting-started/developers.md"
4242
},
43+
{
44+
"path": "getting-started/intellij.md"
45+
},
4346
{
4447
"path": "getting-started/pycharm.md"
4548
}

0 commit comments

Comments
 (0)