Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

pipe "microsoft/azure-web-apps-deploy" doesn't deploy spring boot executable jar

Shehan Simen March 26, 2019

I want to deploy my spring boot project to Azure app service. I setup the bitbucket side as per the document. I have the bitbucket-pipelines.yml step as follows.

- step:
name: deploy to Azure cloud
image: maven:3.5.2
trigger: manual
deployment: production
- mvn clean compile package
- pipe: microsoft/azure-web-apps-deploy:1.0.1
AZURE_APP_ID: xxxxxxxxxxxxxxxxxx
AZURE_PASSWORD: xxxxxxxxxxxxxxxxx
AZURE_TENANT_ID: xxxxxxxxxxxxxxxx
AZURE_RESOURCE_GROUP: 'xxxxxxxxxxxx'
AZURE_APP_NAME: 'xxxxxxxx'
ZIP_FILE: 'app.jar'

Now when I push my code to bitbucket, it sends the app.jar to azure. But it is in exploded (unzipped) version in the D:\home\site\wwwroot> directory of the azure container. So I see all my updated code in the wwwroot, but not in a jar file.  Basically the jar file is unzipped in to directories (BOOT-INF,META-INF, org etc). But my web.config is looking for the app.jar file to execute the spring boot app. This is how web.config look like.

<?xml version="1.0" encoding="UTF-8"?>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments=" -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\app.jar&quot;">

so how can I get the app.jar file in the wwwroot directory of azure container? I can manually create the app.jar using the unzipped (exploded) folders. But it is too much manual process then. Else I should be able to modify the web.config file to run the unzipped version of my spring boot app. I really need help for this. Thank you.

2 answers

0 votes
naveen.kummari March 11, 2022

Hi Simen. Instead of sending the jar file directly as a deployment artifact, compressing it to zip and then sending the zip containing the jar worked for me. After zip gets extracted and jar deployed, we can use web config to run it.

If the deployment fails,  check if Bitbucket is connected in the App service Deployment center and Disconnect it. 

- mvn clean install
- apt-get update && apt-get install -y zip
- zip -r <zip-file-name>.zip {directory}/<jar-name>.jar
- <zip-file-name>.zip
- step:
name: Deploy
- pipe: atlassian/azure-web-apps-deploy:1.0.1
AZURE_APP_NAME: '<string>'
ZIP_FILE: '<zip-file-name>.zip'
0 votes
DavidM March 27, 2019

When you deploy the zip file, you’re engaging Kudu’s deploy­ment mechanism, which will add the files in the .jar to the site/wwwroot folder of your site in App Service. For more information on Kudu, see the Kudu wiki There are some resources there including contacts and some paths to follow such as You could also look at the azure-cli-run pipe to do some bespoke tasks.

Shehan simen March 27, 2019

Hi David, 

The problem is, it is not adding the .jar to /wwwroot folder. It is adding the unzip folders of the jar, to the /wwwroot. So my question is, are there any parameters or configuration in the bitbucket-pipelines.yml to instruct Kudu, to not to unzip the jar? Thanks for your help

DavidM March 27, 2019

Hi Shehan. I understand where you are coming from. Im no Kudu expert.. hence the link to the Kudu team.. The documentation from the web app deploy is here. there isnt anything there that seems to suggest not unpacking. Hence my thoughts on CLI or post action. Try the Kudu wiki for some ideas?  I guess you could put the jar in a zip file if thats what you need?

alejacma March 28, 2019

Hi, if you don't want to unzip the file, you may try Run From Package by setting WEBSITE_RUN_FROM_PACKAGE=1 in your Azure Web App and then do the Zip Deploy. More information can be found here: Run your Azure Functions from a package file. It also applies to Web Apps as they explain here: Announcing zipdeploy integration with Run From Package.

Shehan simen April 1, 2019

Hi David, 

thanks for your guide. Yes finally I put the jar file inside the zip file. It worked. But it would be great if it also works for jar file, as it is an additional step in maven to generate a zip file. but all good now :-)

김범수 May 1, 2021

Hi. Simen. Could you show me the solution in detail? I still have a problem the same as yours... 

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events