Skip to content

Commit b4686a3

Browse files
authored
Merge pull request #77345 from andxu/andxu_webapp_maven_config
update the configuration for maven plugin of app service
2 parents 61b626f + b79bdb1 commit b4686a3

File tree

3 files changed

+66
-39
lines changed

3 files changed

+66
-39
lines changed
-4.46 KB
Loading

articles/app-service/containers/quickstart-java.md

Lines changed: 66 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -58,50 +58,69 @@ Then add the following plugin definition inside the `<build>` element of the `po
5858
<plugin>
5959
<groupId>com.microsoft.azure</groupId>
6060
<artifactId>azure-webapp-maven-plugin</artifactId>
61-
<version>1.5.4</version>
62-
<configuration>
63-
<!-- Specify v2 schema -->
64-
<schemaVersion>v2</schemaVersion>
65-
<!-- App information -->
66-
<subscriptionId>${SUBSCRIPTION_ID}</subscriptionId>
67-
<resourceGroup>${RESOURCEGROUP_NAME}</resourceGroup>
68-
<appName>${WEBAPP_NAME}</appName>
69-
<region>${REGION}</region>
70-
71-
<!-- Java Runtime Stack for App on Linux-->
72-
<runtime>
73-
<os>linux</os>
74-
<javaVersion>jre8</javaVersion>
75-
<webContainer>tomcat 8.5</webContainer>
76-
</runtime>
77-
<deployment>
78-
<resources>
79-
<resource>
80-
<directory>${project.basedir}/target</directory>
81-
<includes>
82-
<include>*.war</include>
83-
</includes>
84-
</resource>
85-
</resources>
86-
</deployment>
87-
</configuration>
61+
<version>1.7.0</version>
8862
</plugin>
8963
</plugins>
90-
```
64+
```
9165

66+
The deploy process to Azure App Service uses account credentials from the Azure CLI. [Sign in with the Azure CLI](/cli/azure/authenticate-azure-cli?view=azure-cli-latest) before continuing.
9267

93-
> [!NOTE]
94-
> In this article we are only working with Java apps packaged in WAR files. The plugin also supports JAR web applications, visit [Deploy a Java SE JAR file to App Service on Linux](https://docs.microsoft.com/java/azure/spring-framework/deploy-spring-boot-java-app-with-maven-plugin?toc=%2fazure%2fapp-service%2fcontainers%2ftoc.json) to try it out.
68+
```azurecli
69+
az login
70+
```
9571

72+
Then you can configure the deployment, run the maven command `mvn azure-webapp:config` in the Command Prompt and use the default configurations by pressing **ENTER** until you get the **Confirm (Y/N)** prompt, then press **'y'** and the configuration is done.
73+
74+
```cmd
75+
~@Azure:~/helloworld$ mvn azure-webapp:config
76+
[INFO] Scanning for projects...
77+
[INFO]
78+
[INFO] ----------------------< example.demo:helloworld >-----------------------
79+
[INFO] Building helloworld Maven Webapp 1.0-SNAPSHOT
80+
[INFO] --------------------------------[ war ]---------------------------------
81+
[INFO]
82+
[INFO] --- azure-webapp-maven-plugin:1.6.0:config (default-cli) @ helloworld ---
83+
[WARNING] The plugin may not work if you change the os of an existing webapp.
84+
Define value for OS(Default: Linux):
85+
1. linux [*]
86+
2. windows
87+
3. docker
88+
Enter index to use:
89+
Define value for javaVersion(Default: jre8):
90+
1. jre8 [*]
91+
2. java11
92+
Enter index to use:
93+
Define value for runtimeStack(Default: TOMCAT 8.5):
94+
1. TOMCAT 9.0
95+
2. jre8
96+
3. TOMCAT 8.5 [*]
97+
4. WILDFLY 14
98+
Enter index to use:
99+
Please confirm webapp properties
100+
AppName : helloworld-1558400876966
101+
ResourceGroup : helloworld-1558400876966-rg
102+
Region : westeurope
103+
PricingTier : Premium_P1V2
104+
OS : Linux
105+
RuntimeStack : TOMCAT 8.5-jre8
106+
Deploy to slot : false
107+
Confirm (Y/N)? : Y
108+
```
109+
110+
> [!NOTE]
111+
> In this article we are only working with Java apps packaged in WAR files. The plugin also supports JAR web applications, visit [Deploy a Java SE JAR file to App Service on Linux](https://docs.microsoft.com/java/azure/spring-framework/deploy-spring-boot-java-app-with-maven-plugin?toc=%2fazure%2fapp-service%2fcontainers%2ftoc.json) to try it out.
96112
97-
Update the following placeholders in the plugin configuration:
113+
Navigate to `pom.xml` again to see the plugin configuration is updated, You can modify other configurations for App Service directly in your pom file if needed, some common ones are listed below:
98114

99-
| Placeholder | Description |
100-
| ----------- | ----------- |
101-
| `SUBSCRIPTION_ID` | The unique ID of the subscription you want to deploy your app to. Default subscription's ID can be found from the Cloud Shell or CLI using the `az account show` command. For all the available subscriptions, use the `az account list` command.|
102-
| `RESOURCEGROUP_NAME` | Name for the new resource group in which to create your app. By putting all the resources for an app in a group, you can manage them together. For example, deleting the resource group would delete all resources associated with the app. Update this value with a unique new resource group name, for example, *TestResources*. You will use this resource group name to clean up all Azure resources in a later section. |
103-
| `WEBAPP_NAME` | The app name will be part the host name for the app when deployed to Azure (WEBAPP_NAME.azurewebsites.net). Update this value with a unique name for the new App Service app, which will host your Java app, for example *contoso*. |
104-
| `REGION` | An Azure region where the app is hosted, for example `westus2`. You can get a list of regions from the Cloud Shell or CLI using the `az account list-locations` command. |
115+
Property | Required | Description | Version
116+
---|---|---|---
117+
`<schemaVersion>` | false | Specify the version of the configuration schema. Supported values are: `v1`, `v2`. | 1.5.2
118+
`<resourceGroup>` | true | Azure Resource Group for your Web App. | 0.1.0+
119+
`<appName>` | true | The name of your Web App. | 0.1.0+
120+
[`<region>`](/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme#region) | true | Specifies the region where your Web App will be hosted; the default value is **westus**. All valid regions at [Supported Regions](/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme#region) section. | 0.1.0+
121+
[`<pricingTier>`](/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme##pricingtier) | false | The pricing tier for your Web App. The default value is **P1V2**.| 0.1.0+
122+
[`<runtime>`](/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme#runtimesetting) | true | The runtime environment configuration, you could see the detail [here](/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme#runtimesetting). | 0.1.0+
123+
[`<deployment>`](/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme#deploymentsetting) | true | The deployment configuration, you could see the details [here](/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme#deploymentsetting). | 0.1.0+
105124

106125
## Deploy the app
107126

@@ -113,11 +132,19 @@ mvn package azure-webapp:deploy
113132

114133
Once deployment has completed, browse to the deployed application using the following URL in your web browser, for example `http://<webapp>.azurewebsites.net`.
115134

116-
![Sample app running in Azure](media/quickstart-java/java-hello-world-in-browser-curl.png)
135+
![Sample app running in Azure](media/quickstart-java/java-hello-world-in-browser.png)
117136

118137
**Congratulations!** You've deployed your first Java app to App Service on Linux.
119138

120-
[!INCLUDE [cli-samples-clean-up](../../../includes/cli-samples-clean-up.md)]
139+
## Clean up resources
140+
141+
In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these resources in the future, delete the resource group by running the following command in the Cloud Shell:
142+
143+
```azurecli-interactive
144+
az group delete --name <your resource group name; for example: helloworld-1558400876966-rg> --yes
145+
```
146+
147+
This command may take a minute to run.
121148

122149
## Next steps
123150

0 commit comments

Comments
 (0)