Skip to content

Commit 7aa8c53

Browse files
authored
Merge pull request #102599 from v-thepet/quickstarts6
Two dev spaces quickstarts
2 parents 3303d21 + ac5a345 commit 7aa8c53

File tree

2 files changed

+58
-71
lines changed

2 files changed

+58
-71
lines changed

articles/dev-spaces/quickstart-java.md

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,21 @@ manager: gwallace
99
---
1010
# Quickstart: Debug and iterate on Kubernetes with Visual Studio Code and Java - Azure Dev Spaces
1111

12-
In this guide, you will learn how to:
13-
14-
- Set up Azure Dev Spaces with a managed Kubernetes cluster in Azure.
15-
- Iteratively develop code in containers using Visual Studio Code.
16-
- Debug the code in your dev space from Visual Studio Code.
17-
18-
Azure Dev Spaces also allows you to debug and iterate using:
19-
- [Node.js and Visual Studio Code](quickstart-nodejs.md)
20-
- [.NET Core and Visual Studio Code](quickstart-netcore.md)
21-
- [.NET Core and Visual Studio](quickstart-netcore-visualstudio.md)
12+
In this quickstart, you set up Azure Dev Spaces with a managed Kubernetes cluster, and use a Java app in Visual Studio Code to iteratively develop and debug code in containers. Azure Dev Spaces lets you debug and test all the components of your application in Azure Kubernetes Service (AKS) with minimal development machine setup.
2213

2314
## Prerequisites
2415

25-
- An Azure subscription. If you don't have one, you can create a [free account](https://azure.microsoft.com/free).
26-
- [Visual Studio Code installed](https://code.visualstudio.com/download).
27-
- The [Azure Dev Spaces](https://marketplace.visualstudio.com/items?itemName=azuredevspaces.azds) and [Java Debugger for Azure Dev Spaces](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debugger-azds) extensions for Visual Studio Code installed.
28-
- [Azure CLI installed](/cli/azure/install-azure-cli?view=azure-cli-latest).
29-
- [Maven installed and configured](https://maven.apache.org).
16+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
17+
- [Java Development Kit (JDK) 1.8.0+](https://aka.ms/azure-jdks).
18+
- [Maven 3.5.0+](https://maven.apache.org/download.cgi).
19+
- [Visual Studio Code](https://code.visualstudio.com/download).
20+
- The [Azure Dev Spaces](https://marketplace.visualstudio.com/items?itemName=azuredevspaces.azds) and [Java Debugger for Azure Dev Spaces](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debugger-azds) extensions for Visual Studio Code.
21+
- [Azure CLI](/cli/azure/install-azure-cli?view=azure-cli-latest).
22+
- [Git](https://www.git-scm.com/downloads).
3023

3124
## Create an Azure Kubernetes Service cluster
3225

33-
You need to create an AKS cluster in a [supported region][supported-regions]. The below commands create a resource group called *MyResourceGroup* and an AKS cluster called *MyAKS*.
26+
You need to create an AKS cluster in a [supported region][supported-regions]. The following commands create a resource group called *MyResourceGroup* and an AKS cluster called *MyAKS*.
3427

3528
```cmd
3629
az group create --name MyResourceGroup --location eastus
@@ -39,14 +32,15 @@ az aks create -g MyResourceGroup -n MyAKS --location eastus --disable-rbac --gen
3932

4033
## Enable Azure Dev Spaces on your AKS cluster
4134

42-
Use the `use-dev-spaces` command to enable Dev Spaces on your AKS cluster and follow the prompts. The below command enables Dev Spaces on the *MyAKS* cluster in the *MyResourceGroup* group and creates a *default* dev space.
35+
Use the `use-dev-spaces` command to enable Dev Spaces on your AKS cluster and follow the prompts. The following command enables Dev Spaces on the *MyAKS* cluster in the *MyResourceGroup* group and creates a *default* dev space.
4336

4437
> [!NOTE]
45-
> The `use-dev-spaces` command will also install the Azure Dev Spaces CLI if its not already installed. You cannot install the Azure Dev Spaces CLI in the Azure Cloud Shell.
38+
> The `use-dev-spaces` command will also install the Azure Dev Spaces CLI if its not already installed. You can't install the Azure Dev Spaces CLI in the Azure Cloud Shell.
4639
4740
```cmd
4841
$ az aks use-dev-spaces -g MyResourceGroup -n MyAKS
4942
43+
5044
'An Azure Dev Spaces Controller' will be created that targets resource 'MyAKS' in resource group 'MyResourceGroup'. Continue? (y/N): y
5145
5246
Creating and selecting Azure Dev Spaces Controller 'MyAKS' in resource group 'MyResourceGroup' that targets resource 'MyAKS' in resource group 'MyResourceGroup'...2m 24s
@@ -74,11 +68,11 @@ git clone https://github.com/Azure/dev-spaces
7468

7569
## Prepare the sample application in Visual Studio Code
7670

77-
Open Visual Studio Code, click *File* then *Open...*, navigate to the *dev-spaces/samples/java/getting-started/webfrontend* directory, and click *Open*.
71+
Open Visual Studio Code, select **File** then **Open**, navigate to the *dev-spaces/samples/java/getting-started/webfrontend* directory, and select **Open**.
7872

7973
You now have the *webfrontend* project open in Visual Studio Code. To run the application in your dev space, generate the Docker and Helm chart assets using the Azure Dev Spaces extension in the Command Palette.
8074

81-
To open the Command Palette in Visual Studio Code, click *View* then *Command Palette*. Begin typing `Azure Dev Spaces` and click on `Azure Dev Spaces: Prepare configuration files for Azure Dev Spaces`.
75+
To open the Command Palette in Visual Studio Code, select **View** then **Command Palette**. Begin typing `Azure Dev Spaces` and select **Azure Dev Spaces: Prepare configuration files for Azure Dev Spaces**.
8276

8377
![Prepare configuration files for Azure Dev Spaces](./media/common/command-palette.png)
8478

@@ -93,59 +87,59 @@ When Visual Studio Code also prompts you to configure your base images, exposed
9387
This command prepares your project to run in Azure Dev Spaces by generating a Dockerfile and Helm chart. It also generates a *.vscode* directory with debugging configuration at the root of your project.
9488

9589
> [!TIP]
96-
> The [Dockerfile and Helm chart](how-dev-spaces-works.md#prepare-your-code) for your project is used by Azure Dev Spaces to build and run your code, but you can modify these files if you want to change how the project is built and ran.
90+
> The [Dockerfile and Helm chart](how-dev-spaces-works.md#prepare-your-code) for your project is used by Azure Dev Spaces to build and run your code, but you can modify these files if you want to change how the project is built and run.
9791
98-
## Build and run code in Kubernetes from Visual Studio
92+
## Build and run code in Kubernetes from Visual Studio Code
9993

100-
Click on the *Debug* icon on the left and click *Launch Java Program (AZDS)* at the top.
94+
Select the **Debug** icon on the left and select **Launch Java Program (AZDS)** at the top.
10195

10296
![Launch Java Program](media/get-started-java/debug-configuration.png)
10397

104-
This command builds and runs your service in Azure Dev Spaces. The *Terminal* window at the bottom shows the build output and URLs for your service running Azure Dev Spaces. The *Debug Console* shows the log output.
98+
This command builds and runs your service in Azure Dev Spaces. The **Terminal** window at the bottom shows the build output and URLs for your service running Azure Dev Spaces. The **Debug Console** shows the log output.
10599

106100
> [!Note]
107-
> If you don't see any Azure Dev Spaces commands in the *Command Palette*, make sure you have installed the [Visual Studio Code extension for Azure Dev Spaces](https://marketplace.visualstudio.com/items?itemName=azuredevspaces.azds). Also verify you opened the *dev-spaces/samples/java/getting-started/webfrontend* directory in Visual Studio Code.
101+
> If you don't see any Azure Dev Spaces commands in the **Command Palette**, make sure you have installed the [Visual Studio Code extension for Azure Dev Spaces](https://marketplace.visualstudio.com/items?itemName=azuredevspaces.azds). Also verify you opened the *dev-spaces/samples/java/getting-started/webfrontend* directory in Visual Studio Code.
108102
109103
You can see the service running by opening the public URL.
110104

111-
Click *Debug* then *Stop Debugging* to stop the debugger.
105+
Select **Debug** then **Stop Debugging** to stop the debugger.
112106

113107
## Update code
114108

115-
To deploy an updated version of your service, you can update any file in your project and rerun *Launch Java Program (AZDS)*. For example:
109+
To deploy an updated version of your service, you can update any file in your project and rerun **Launch Java Program (AZDS)**. For example:
116110

117-
1. If your application is still running, click *Debug* then *Stop Debugging* to stop it.
111+
1. If your application is still running, select **Debug** then **Stop Debugging** to stop it.
118112
1. Update [line 19 in `src/main/java/com/ms/sample/webfrontend/Application.java`](https://github.com/Azure/dev-spaces/blob/master/samples/java/getting-started/webfrontend/src/main/java/com/ms/sample/webfrontend/Application.java#L19) to:
119113

120114
```java
121115
return "Hello from webfrontend in Azure!";
122116
```
123117

124118
1. Save your changes.
125-
1. Rerun *Launch Java Program (AZDS)*.
119+
1. Rerun **Launch Java Program (AZDS)**.
126120
1. Navigate to your running service and observe your changes.
127-
1. Click *Debug* then *Stop Debugging* to stop your application.
121+
1. Select **Debug** then **Stop Debugging** to stop your application.
128122

129123
## Setting and using breakpoints for debugging
130124

131-
Start your service using *Launch Java Program (AZDS)*. This also runs your service in debugging mode.
125+
Start your service using **Launch Java Program (AZDS)**. This also runs your service in debugging mode.
132126

133-
Navigate back to the *Explorer* view by clicking *View* then *Explorer*. Open `src/main/java/com/ms/sample/webfrontend/Application.java` and click somewhere on line 19 to put your cursor there. To set a breakpoint hit *F9* or click *Debug* then *Toggle Breakpoint*.
127+
Navigate back to the **Explorer** view by selecting **View** then **Explorer**. Open *src/main/java/com/ms/sample/webfrontend/Application.java* and click somewhere on line 19 to put your cursor there. To set a breakpoint press **F9** or select **Debug** then **Toggle Breakpoint**.
134128

135-
Open your service in a browser and notice no message is displayed. Return to Visual Studio Code and observe line 19 is highlighted. The breakpoint you set has paused the service at line 19. To resume the service, hit *F5* or click *Debug* then *Continue*. Return to your browser and notice the message is now displayed.
129+
Open your service in a browser and notice no message is displayed. Return to Visual Studio Code and observe line 19 is highlighted. The breakpoint you set has paused the service at line 19. To resume the service, press **F5** or select **Debug** then **Continue**. Return to your browser and notice the message is now displayed.
136130

137131
While running your service in Kubernetes with a debugger attached, you have full access to debug information such as the call stack, local variables, and exception information.
138132

139-
Remove the breakpoint by putting your cursor on line 19 in `src/main/java/com/ms/sample/webfrontend/Application.java` and hitting *F9*.
133+
Remove the breakpoint by putting your cursor on line 19 in *src/main/java/com/ms/sample/webfrontend/Application.java* and pressing **F9**.
140134

141135
## Update code from Visual Studio Code
142136

143-
While the service is running in debugging mode, update line 19 in `src/main/java/com/ms/sample/webfrontend/Application.java`. For example:
137+
While the service is running in debugging mode, update line 19 in *src/main/java/com/ms/sample/webfrontend/Application.java*. For example:
144138
```java
145139
return "Hello from webfrontend in Azure while debugging!";
146140
```
147141

148-
Save the file. Click *Debug* then *Restart Debugging* or in the *Debug toolbar*, click the *Restart Debugging* button.
142+
Save the file. Select **Debug** then **Restart Debugging** or in the **Debug toolbar**, select the **Restart Debugging** button.
149143

150144
![Refresh Debugging](media/common/debug-action-refresh.png)
151145

0 commit comments

Comments
 (0)