It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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
script:
- mvn clean compile package
- pipe: microsoft/azure-web-apps-deploy:1.0.1
variables:
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"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\app.jar&quot;">
</httpPlatform>
</system.webServer>
</configuration>

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.

1 answer

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 https://github.com/projectkudu/kudu/wiki. There are some resources there including contacts and some paths to follow such as https://github.com/projectkudu/kudu/wiki. You could also look at the azure-cli-run pipe to do some bespoke tasks.

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

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?

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.

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 :-)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,051 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you