问题描述
所以我用 Spark 做了一个简单的 java 项目,并试图将它部署到 Azure,但是虽然它符合并说部署成功,但它不会显示任何内容.我同时使用了 web+mobile 部署和 java jetty 部署,但都没有奏效.谁能告诉我是什么问题?
github 项目的链接是
在 Azure WebApps 上部署 Java Web 应用程序类似于将其部署到 Tomcat 或 Jetty.您应该将它部署到目录 webapps
中.在 Azure WebApps 上,webapps
位于路径 D:\home\site\wwwroot
.您可以通过 Kudu
工具的调试控制台在 url https://<azure_webapp_name>.scm.azurewebsites.net/DebugConsole
中找到它.
当您从 GitHub 部署项目时,Azure 将克隆文件 &从 GitHub 到 Azure 上路径 wwwroot
的项目存储库分支的目录.
所以从 Github 部署的简单方法是推送 webapps/
目录包含的文件 &将 Java Web 应用程序存档目录添加到 GitHub 存储库中.Azure 将帮助您提取和开发它们.
然后就可以浏览网址https://<azure_webapp_name>.azurewebsites.net/<java_app_name>/
.
如果您使用 Eclipse 创建 Java Web 项目,则该项目中将包含目录 WebContent
.您只需要将 WebContent
的内容复制到 webapps/
目录并将 webapps
推送到 GitHub 存储库.
So I made a simple java project with Spark and was trying to deploy it to Azure, but although it complies and says deploy successfully, it won't show any content. I used both the web+mobile deployment and the java jetty deployment, but none worked. Can anyone tell me what is the problem?
The link to the github project is https://github.com/tonymuu/mini-twitter-clone
And the link to the website is minitwitter.azurewebsites.net
There are some documents and vedios to help you deploying Java web project into Azure from GitHub.
- Vedio: Deploying to Web Sites with GitHub using Kudu - with David Ebbo https://azure.microsoft.com/en-us/documentation/videos/deploying-to-azure-from-github/
- Document: Deploying from github https://github.com/projectkudu/kudu/wiki/Deploying-from-github
But for your issue, I checked your Java project on GitHub, and I found the repository only contains Java source code, not be a Java web application archive directory what contains the directories WEB-INF
& META-INFO
, and Java classes files in the path WEB-INF/classes
and other web files, as the picture below:
Deploying Java web application on Azure WebApps is similar to deploying it into Tomcat or Jetty. You should deploy it into the directory webapps
. on Azure WebApps, the webapps
is at the path D:\home\site\wwwroot
. You can find it thru the Debug console of Kudu
Tool at the url https://<azure_webapp_name>.scm.azurewebsites.net/DebugConsole
.
When you are deploying project from GitHub, the Azure will clone the files & directories of a branch of project repository from GitHub to the path wwwroot
on Azure.
So the simple way to deploy from Github is push the webapps/<java_app_name>
directory contains the files & directories of your Java web application archive into GitHub repository. Azure will help you pulling and deloping them.
Then you can browse the url https://<azure_webapp_name>.azurewebsites.net/<java_app_name>/
.
If you create a Java web project by using Eclipse, the directory WebContent
will be contained in the project. You just need to copy the content of WebContent
into webapps/<java_app_name>
dir and push webapps
into GitHub repo.
这篇关于如何将github上的java项目部署到Azure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!