You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/includes/quickstart-java/quickstart-java-javase.md
+63-31Lines changed: 63 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,18 @@ ms.date: 06/10/2025
7
7
ms.author: cephalin
8
8
---
9
9
10
-
In this quickstart, you use the Maven plugin to deploy a Java web application with an embedded Spring Boot, Quarkus, or Tomcat server to App Service by using the [azure-webapp-maven-plugin](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Web-App).
10
+
This quickstart uses the Maven plugin to deploy a Java web application with an embedded Spring Boot, Quarkus, or Tomcat server to App Service by using the [azure-webapp-maven-plugin](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Web-App).
- Run the commands in this quickstart by using Azure Cloud Shell, an interactive shell that you can use through your browser to work with Azure services. To use Cloud Shell:
17
17
18
-
1. Select **Open Cloud Shell** at upper right in a code block and sign in to Azure if necessary. Make sure you're in the **Bash** environment of Cloud Shell.
19
-
1. Select **Copy** in the code block, paste the code into Cloud Shell, and run it.
18
+
1. Select the following **Launch Cloud Shell** button or go to https://shell.azure.com to open Cloud Shell in your browser.
19
+
:::image type="icon" source="~/reusable-content/ce-skilling/azure/media/cloud-shell/launch-cloud-shell-button.png" alt-text="Button to launch the Azure Cloud Shell." border="false" link="https://shell.azure.com":::
20
+
1. Sign in to Azure if necessary, and make sure you're in the **Bash** environment of Cloud Shell.
21
+
1. Select **Copy** in a code block, paste the code into Cloud Shell, and run it.
20
22
21
23
## Get the sample app
22
24
@@ -36,7 +38,7 @@ Then change your working directory to the project folder by running `cd my-webap
36
38
37
39
1. Generate a new Quarkus app named `quarkus-hello-azure` by running the following Maven command:
@@ -130,18 +132,42 @@ You can modify the configurations for App Service directly in your *pom.xml* fil
130
132
131
133
With all the configuration ready in your [pom.xml](https://github.com/Azure-Samples/java-docs-embedded-tomcat/blob/main/pom.xml) file, you can deploy your Java app to Azure.
132
134
135
+
### [Spring Boot](#tab/springboot)
136
+
133
137
1. Build the JAR file using the following command.
134
138
135
-
### [Spring Boot](#tab/springboot)
136
-
137
139
```bash
138
140
mvn clean package
139
141
```
140
142
141
143
> [!TIP]
142
144
> Spring Boot produces two JAR files with `mvn package`, but the `azure-webapp-maven-plugin` picks the right JAR file to deploy automatically.
143
145
144
-
### [Quarkus](#tab/quarkus)
146
+
1. Deploy the app to Azure by using the following command:
147
+
148
+
```bash
149
+
mvn azure-webapp:deploy
150
+
```
151
+
152
+
Once you select from a list of available subscriptions, Maven deploys to Azure App Service. When deployment completes, your application is ready, and you see the following output:
153
+
154
+
```output
155
+
[INFO] Successfully deployed the artifact to <URL>
1. Open your app's default domain from the **Overview** page in the Azure portal, and append `/greeting` to the URL. You should see the following app:
165
+
166
+
:::image type="content" source="../../media/quickstart-java/springboot-hello-world-in-browser-azure-app-service.png" alt-text="Screenshot of Spring Boot Hello World web app running in Azure App Service.":::
167
+
168
+
### [Quarkus](#tab/quarkus)
169
+
170
+
1. Build the JAR file using the following command.
@@ -153,7 +179,31 @@ With all the configuration ready in your [pom.xml](https://github.com/Azure-Samp
153
179
> [!TIP]
154
180
> Quarkus produces two JAR files with `mvn package`, but `azure-webapp-maven-plugin` picks the right JAR file to deploy automatically.
155
181
156
-
### [Embedded Tomcat](#tab/embeddedtomcat)
182
+
1. Deploy the app to Azure by using the following command:
183
+
184
+
```bash
185
+
mvn azure-webapp:deploy
186
+
```
187
+
188
+
Once you select from a list of available subscriptions, Maven deploys to Azure App Service. When deployment completes, your application is ready, and you see the following output:
189
+
190
+
```output
191
+
[INFO] Successfully deployed the artifact to <URL>
1. Open your app's default domain from the **Overview** in the Azure portal, and append `/hello` to the URL. You should see the following app:
201
+
202
+
:::image type="content" source="../../media/quickstart-java/quarkus-hello-world-in-browser-azure-app-service.png" alt-text="Screenshot of Quarkus web app running in Azure App Service.":::
203
+
204
+
### [Embedded Tomcat](#tab/embeddedtomcat)
205
+
206
+
1. Build the JAR file using the following command.
157
207
158
208
```bash
159
209
mvn clean package
@@ -165,8 +215,6 @@ With all the configuration ready in your [pom.xml](https://github.com/Azure-Samp
165
215
- Creates an [executable JAR](https://en.wikipedia.org/wiki/JAR_(file_format)#Executable_JAR_files) by specifying the Tomcat class as the startup class.
166
216
- Replaces the original artifact with the `Uber-Jar` to ensure that the deploy step deploys the right file.
167
217
168
-
-----
169
-
170
218
1. Deploy the app to Azure by using the following command:
171
219
172
220
```bash
@@ -185,27 +233,11 @@ With all the configuration ready in your [pom.xml](https://github.com/Azure-Samp
Open your app's default domain from the **Overview** page in the Azure portal, and append `/greeting` to the URL. You should see the following app:
193
-
194
-
:::image type="content" source="../../media/quickstart-java/springboot-hello-world-in-browser-azure-app-service.png" alt-text="Screenshot of Spring Boot Hello World web app running in Azure App Service.":::
195
-
196
-
### [Quarkus](#tab/quarkus)
197
-
198
-
Open your app's default domain from the **Overview** in the Azure portal, and append `/hello` to the URL. You should see the following app:
199
-
200
-
:::image type="content" source="../../media/quickstart-java/quarkus-hello-world-in-browser-azure-app-service.png" alt-text="Screenshot of Quarkus web app running in Azure App Service.":::
201
-
202
-
### [Embedded Tomcat](#tab/embeddedtomcat)
203
-
204
-
Open the URL for your app's default domain from the **Overview** in the Azure portal. You should see the following app:
236
+
1. Open the URL for your app's default domain from the **Overview** in the Azure portal. You should see the following app:
205
237
206
238
:::image type="content" source="../../media/quickstart-java/embedded-tomcat-hello-world-in-browser-azure-app-service.png" alt-text="Screenshot of embedded Tomcat web app running in Azure App Service.":::
207
-
208
-
-----
239
+
240
+
-----
209
241
210
242
Congratulations! You deployed a Java app to App Service.
- Run the commands in this quickstart by using Azure Cloud Shell, an interactive shell that you can use through your browser to work with Azure services. To use Cloud Shell:
17
17
18
-
1. Select **Open Cloud Shell** at upper right in a code block and sign in to Azure if necessary. Make sure you're in the **Bash** environment of Cloud Shell.
19
-
1. Select **Copy** in the code block, paste the code into Cloud Shell, and run it.
18
+
1. Select the following **Launch Cloud Shell** button or go to https://shell.azure.com to open Cloud Shell in your browser.
19
+
:::image type="icon" source="~/reusable-content/ce-skilling/azure/media/cloud-shell/launch-cloud-shell-button.png" alt-text="Button to launch the Azure Cloud Shell." border="false" link="https://shell.azure.com":::
20
+
1. Sign in to Azure if necessary, and make sure you're in the **Bash** environment of Cloud Shell.
21
+
1. Select **Copy** in a code block, paste the code into Cloud Shell, and run it.
- Run the commands in this quickstart by using Azure Cloud Shell, an interactive shell that you can use through your browser to work with Azure services. To use Cloud Shell:
17
17
18
-
1. Select **Open Cloud Shell** at upper right in a code block and sign in to Azure if necessary. Make sure you're in the **Bash** environment of Cloud Shell.
19
-
1. Select **Copy** in the code block, paste the code into Cloud Shell, and run it.
18
+
1. Select the following **Launch Cloud Shell** button or go to https://shell.azure.com to open Cloud Shell in your browser.
19
+
:::image type="icon" source="~/reusable-content/ce-skilling/azure/media/cloud-shell/launch-cloud-shell-button.png" alt-text="Button to launch the Azure Cloud Shell." border="false" link="https://shell.azure.com":::
20
+
1. Sign in to Azure if necessary, and make sure you're in the **Bash** environment of Cloud Shell.
21
+
1. Select **Copy** in a code block, paste the code into Cloud Shell, and run it.
20
22
21
23
## Create a Java app
22
24
23
25
Run the following Maven command in Cloud Shell to create a new app named `helloworld`:
@@ -100,7 +102,7 @@ You can modify the configurations for App Service directly in your *pom.xml* fil
100
102
101
103
With all the configuration ready in the *pom.xml* file, you can deploy your Java app to Azure with the following single command.
102
104
103
-
```azurecli-interactive
105
+
```bash
104
106
mvn package azure-webapp:deploy
105
107
```
106
108
@@ -114,7 +116,7 @@ Congratulations! You deployed a Java app to App Service.
114
116
115
117
## Clean up resources
116
118
117
-
You created the resources for this tutorial in an Azure resource group. If you no longer need them, you can delete the resource group and all its resources by running the following Azure CLI command in the Cloud Shell.
119
+
You created the resources for this tutorial in an Azure resource group. If you no longer need them, you can delete the resource group and all its resources by running the following Azure CLI command in Cloud Shell.
118
120
119
121
```azurecli-interactive
120
122
az group delete --name helloworld-1745408005556-rg --yes
0 commit comments