Skip to content

Commit c8ec64d

Browse files
authored
Merge pull request #298789 from cephalin/links
update java quickstart
2 parents bcb4862 + 6147191 commit c8ec64d

File tree

5 files changed

+93
-120
lines changed

5 files changed

+93
-120
lines changed

articles/app-service/includes/quickstart-java/quickstart-java-javase.md

Lines changed: 58 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ author: cephalin
33
ms.service: azure-app-service
44
ms.devlang: java
55
ms.topic: include
6-
ms.date: 02/10/2024
6+
ms.date: 04/23/2025
77
ms.author: cephalin
88
---
99

1010
In this quickstart, you use the [Maven Plugin for Azure App Service Web Apps](https://github.com/microsoft/azure-maven-plugins/blob/develop/azure-webapp-maven-plugin/README.md) to deploy a Java web application with an embedded server to [Azure App Service](/azure/app-service/). App Service provides a highly scalable, self-patching web app hosting service. Use the tabs to switch between Tomcat, JBoss, or embedded server (Java SE) instructions.
1111

12-
The quickstart deploys either a Spring Boot app, embedded Tomcat, or Quarkus app using the [azure-webapp-maven-plugin](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Web-App) plugin.
12+
The quickstart deploys either a Spring Boot app, Quarkus app, or embedded Tomcat using the [azure-webapp-maven-plugin](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Web-App) plugin.
1313

1414
### [Spring Boot](#tab/springboot)
1515

1616
:::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 in introduction.":::
1717

18-
### [Embedded Tomcat](#tab/embeddedtomcat)
19-
20-
:::image type="content" source="../../media/quickstart-java/embedded-tomcat-hello-world-in-browser-azure-app-service.png" alt-text="Screenshot of embedded Tomcat Hello World web app running in Azure App Service in introduction.":::
21-
2218
### [Quarkus](#tab/quarkus)
2319

2420
:::image type="content" source="../../media/quickstart-java/quarkus-hello-world-in-browser-azure-app-service.png" alt-text="Screenshot of Quarkus Hello World web app running in Azure App Service in introduction.":::
2521

22+
### [Embedded Tomcat](#tab/embeddedtomcat)
23+
24+
:::image type="content" source="../../media/quickstart-java/embedded-tomcat-hello-world-in-browser-azure-app-service.png" alt-text="Screenshot of embedded Tomcat Hello World web app running in Azure App Service in introduction.":::
25+
2626
-----
2727

2828
If Maven isn't your preferred development tool, check out our similar tutorials for Java developers:
@@ -53,39 +53,39 @@ If Maven isn't your preferred development tool, check out our similar tutorials
5353
cd my-webapp
5454
```
5555

56-
### [Embedded Tomcat](#tab/embeddedtomcat)
56+
### [Quarkus](#tab/quarkus)
5757

58-
1. Download and extract the [embeddedTomcatExample](https://github.com/Azure-Samples/java-docs-embedded-tomcat) repository, or clone it locally by running `git clone`:
58+
1. Generate a new Quarkus app named `quarkus-hello-azure` with the following Maven command:
5959

60-
```bash
61-
git clone https://github.com/Azure-Samples/java-docs-embedded-tomcat
60+
```azurecli-interactive
61+
mvn io.quarkus.platform:quarkus-maven-plugin:3.21.3:create \
62+
-DprojectGroupId=org.acme \
63+
-DprojectArtifactId=quarkus-hello-azure \
64+
-Dextensions='resteasy-reactive'
6265
```
6366

6467
1. Change your working directory to the project folder:
6568

6669
```azurecli-interactive
67-
cd java-docs-embedded-tomcat
70+
cd quarkus-hello-azure
6871
```
6972

70-
The application is run using the standard [Tomcat](https://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/catalina/startup/Tomcat.html) class (see [Main.java](https://github.com/Azure-Samples/java-docs-embedded-tomcat/blob/main/src/main/java/com/microsoft/azure/appservice/examples/embeddedtomcat/Main.java) in the sample).
71-
72-
### [Quarkus](#tab/quarkus)
73+
### [Embedded Tomcat](#tab/embeddedtomcat)
7374

74-
1. Generate a new Quarkus app named `quarkus-hello-azure` with the following Maven command:
75+
1. Download and extract the [embeddedTomcatExample](https://github.com/Azure-Samples/java-docs-embedded-tomcat) repository, or clone it locally by running `git clone`:
7576

76-
```azurecli-interactive
77-
mvn io.quarkus.platform:quarkus-maven-plugin:3.2.2.Final:create \
78-
-DprojectGroupId=org.acme \
79-
-DprojectArtifactId=quarkus-hello-azure \
80-
-Dextensions='resteasy-reactive'
77+
```bash
78+
git clone https://github.com/Azure-Samples/java-docs-embedded-tomcat
8179
```
8280

8381
1. Change your working directory to the project folder:
8482

8583
```azurecli-interactive
86-
cd quarkus-hello-azure
84+
cd java-docs-embedded-tomcat
8785
```
8886

87+
The application is run using the standard [Tomcat](https://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/catalina/startup/Tomcat.html) class (see [Main.java](https://github.com/Azure-Samples/java-docs-embedded-tomcat/blob/main/src/main/java/com/microsoft/azure/appservice/examples/embeddedtomcat/Main.java) in the sample).
88+
8989
-----
9090

9191
## 3 - Configure the Maven plugin
@@ -95,12 +95,12 @@ The deployment process to Azure App Service uses your Azure credentials from the
9595
Run the Maven command shown next to configure the deployment. This command helps you to set up the App Service operating system, Java version, and Tomcat version.
9696
9797
```azurecli-interactive
98-
mvn com.microsoft.azure:azure-webapp-maven-plugin:2.13.0:config
98+
mvn com.microsoft.azure:azure-webapp-maven-plugin:2.14.1:config
9999
```
100100
101101
1. For **Create new run configuration**, type **Y**, then **Enter**.
102102
1. For **Define value for OS**, type **2** for Linux, then **Enter**.
103-
1. For **Define value for javaVersion**, type **1** for Java 17, then **Enter**.
103+
1. For **Define value for javaVersion**, type **1** for Java 21, then **Enter**.
104104
1. For **Define value for pricingTier**, type **3** for P1v2, then **Enter**.
105105
1. For **Confirm**, type **Y**, then **Enter**.
106106
@@ -111,16 +111,16 @@ mvn com.microsoft.azure:azure-webapp-maven-plugin:2.13.0:config
111111
Region : centralus
112112
PricingTier : P1v2
113113
OS : Linux
114-
Java Version: Java 17
114+
Java Version: Java 21
115115
Web server stack: Java SE
116116
Deploy to slot : false
117-
Confirm (Y/N) [Y]: y
117+
Confirm (Y/N) [Y]:
118118
[INFO] Saving configuration to pom.
119119
[INFO] ------------------------------------------------------------------------
120120
[INFO] BUILD SUCCESS
121121
[INFO] ------------------------------------------------------------------------
122-
[INFO] Total time: 8.139 s
123-
[INFO] Finished at: 2023-07-26T12:42:48Z
122+
[INFO] Total time: 47.533 s
123+
[INFO] Finished at: 2025-04-23T12:20:08Z
124124
[INFO] ------------------------------------------------------------------------
125125
```
126126
@@ -146,35 +146,42 @@ The relevant portion of the `pom.xml` file should look similar to the following
146146
</build>
147147
```
148148

149-
You can modify the configurations for App Service directly in your `pom.xml`. Some common configurations are listed in the following table:
149+
You can modify the configurations for App Service directly in your `pom.xml`.
150150

151-
Property | Required | Description | Version
152-
---|---|---|---
153-
`<schemaVersion>` | false | Specify the version of the configuration schema. Supported values are: `v1`, `v2`. | 1.5.2
154-
`<subscriptionId>` | false | Specify the subscription ID. | 0.1.0+
155-
`<resourceGroup>` | true | Azure Resource Group for your Web App. | 0.1.0+
156-
`<appName>` | true | The name of your Web App. | 0.1.0+
157-
`<region>` | false | Specifies the region to host your Web App; the default value is **centralus**. All valid regions at [Supported Regions](https://azure.microsoft.com/global-infrastructure/services/?products=app-service) section. | 0.1.0+
158-
`<pricingTier>` | false | The pricing tier for your Web App. The default value is **P1v2** for production workload, while **B2** is the recommended minimum for Java dev/test. For more information, see [App Service Pricing](https://azure.microsoft.com/pricing/details/app-service/linux/)| 0.1.0+
159-
`<runtime>` | false | The runtime environment configuration. For more information, see [Configuration Details](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Web-App:-Configuration-Details). | 0.1.0+
160-
`<deployment>` | false | The deployment configuration. For more information, see [Configuration Details](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Web-App:-Configuration-Details). | 0.1.0+
161-
162-
For the complete list of configurations, see the plugin reference documentation. All the Azure Maven Plugins share a common set of configurations. For these configurations see [Common Configurations](https://github.com/microsoft/azure-maven-plugins/wiki/Common-Configuration). For configurations specific to App Service, see [Azure Web App: Configuration Details](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Web-App:-Configuration-Details).
151+
- For the complete list of configurations, see [Common Configurations](https://github.com/microsoft/azure-maven-plugins/wiki/Common-Configuration).
152+
- For configurations specific to App Service, see [Azure Web App: Configuration Details](https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Web-App:-Configuration-Details).
163153

164154
Be careful about the values of `<appName>` and `<resourceGroup>`. They're used later.
165155
166156
## 4 - Deploy the app
167157
168158
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 with one single command.
169159
170-
1. Build the JAR file using the following command:
160+
1. Build the JAR file using the following command(s):
171161
172162
### [Spring Boot](#tab/springboot)
173163
174164
```bash
175165
mvn clean package
176166
```
177167
168+
> [!TIP]
169+
> Spring Boot produces two JAR files with `mvn package`, but `azure-webapp-maven-plugin` picks the right JAR file to deploy automatically.
170+
171+
### [Quarkus](#tab/quarkus)
172+
173+
```bash
174+
echo "%prod.quarkus.http.port=80" >> src/main/resources/application.properties
175+
mvn clean package -Dquarkus.package.jar.type=uber-jar
176+
```
177+
178+
In these commands:
179+
- You set the Quarkus port in the *application.properties* file to match the default port that the Linux Java container uses.
180+
- `quarkus.package.jar.type=uber-jar` tells Maven to [generate an Uber-Jar](https://quarkus.io/guides/maven-tooling#uber-jar-maven), which includes all dependencies in the JAR file.
181+
182+
> [!TIP]
183+
> Quarkus produces two JAR files with `mvn package`, but `azure-webapp-maven-plugin` picks the right JAR file to deploy automatically.
184+
178185
### [Embedded Tomcat](#tab/embeddedtomcat)
179186
180187
```bash
@@ -187,22 +194,6 @@ With all the configuration ready in your [pom.xml](https://github.com/Azure-Samp
187194
- Create an [executable JAR](https://en.wikipedia.org/wiki/JAR_(file_format)#Executable_JAR_files) by specifying the Tomcat class as the start-up class.
188195
- Replace the original artifact with the uber JAR to ensure that the deploy step deploys the right file.
189196
190-
> [!TIP]
191-
> Quarkus and Spring Boot both produce two JAR files with `mvn clean package`, but `azure-webapp-maven-plugin` picks the right JAR file to deploy automatically.
192-
193-
### [Quarkus](#tab/quarkus)
194-
195-
```bash
196-
mvn clean package -Dquarkus.package.type=uber-jar -D%prod.quarkus.http.port=80
197-
```
198-
199-
This command adds two Quarkus properties:
200-
201-
- `quarkus.package.type=uber-jar` tells Maven to [generate an Uber-Jar](https://quarkus.io/guides/maven-tooling#uber-jar-maven), which includes all dependencies in the JAR file.
202-
- `%prod.quarkus.http.port=80` tells Quarkus to use port 80 for the prod environment at runtime, which is the default port that the Linux Java container uses. If you want, you can change the port number of the Java container with the `WEBSITES_PORT` app setting.
203-
204-
You can configure these properties by using other means, but they're added to `mvn package` command here for simplicity.
205-
206197
-----
207198
208199
2. Deploy to Azure by using the following command:
@@ -211,7 +202,7 @@ With all the configuration ready in your [pom.xml](https://github.com/Azure-Samp
211202
mvn azure-webapp:deploy
212203
```
213204
214-
If the deployment succeeds, you see the following output:
205+
Once you select from a list of available subscriptions, Maven deploys to Azure App Service. When the deployment completes, you see the following output:
215206
216207
```output
217208
[INFO] Successfully deployed the artifact to https://<app-name>.azurewebsites.net
@@ -223,23 +214,25 @@ With all the configuration ready in your [pom.xml](https://github.com/Azure-Samp
223214
[INFO] ------------------------------------------------------------------------
224215
```
225216
217+
Your application is ready at `http://<appName>.azurewebsites.net/`.
218+
226219
### [Spring Boot](#tab/springboot)
227220
228-
Once deployment is completed, your application is ready at `http://<appName>.azurewebsites.net/`. Open the URL `http://<appName>.azurewebsites.net/greeting` with your local web browser (note the `/greeting` path), and you should see:
221+
Open the URL `http://<appName>.azurewebsites.net/greeting` with your local web browser (note the `/greeting` path), and you should see:
229222
230223
:::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.":::
231224
232-
### [Embedded Tomcat](#tab/embeddedtomcat)
225+
### [Quarkus](#tab/quarkus)
233226
234-
Once deployment is completed, your application is ready at `http://<appName>.azurewebsites.net/`. Open the url with your local web browser, and you should see:
227+
Open the URL `http://<appName>.azurewebsites.net/hello` with your local web browser (note the `/hello` path), and you should see:
235228
236-
:::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.":::
229+
:::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.":::
237230
238-
### [Quarkus](#tab/quarkus)
231+
### [Embedded Tomcat](#tab/embeddedtomcat)
239232
240-
Once deployment is completed, your application is ready at `http://<appName>.azurewebsites.net/`. Open the url with your local web browser, and you should see:
233+
Open the URLl with your local web browser, and you should see:
241234
242-
:::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.":::
235+
:::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.":::
243236
244237
-----
245238

0 commit comments

Comments
 (0)