Are you using GitHub actions? Here we have more info about github actions for building java web apps and publishing to Azure App Service:
https://azure.github.io/AppService/2019/08/10/Github-actions-for-webapps.html#java
If you are trying to build the java Web App using kudu, we don't have the JDK in Kudu and we recommend to try GitHub actions instead.