简体   繁体   English

使用gcloud app deploy部署Google App Engine Java Eclipse项目

[英]Deploy Google App Engine Java Eclipse project with gcloud app deploy

I usually use Eclipse and Google Cloud Tools plugin for Eclipse so I'm not really familiar with the command line tools. 我通常使用Eclipse和Eclipse的Google Cloud Tools插件,因此我对命令行工具不是很熟悉。 Now I have some deployment issues and I'd like to try to deploy using "gcloud app deploy". 现在,我遇到了一些部署问题,我想尝试使用“ gcloud app deploy”进行部署。

I installed Google Cloud SDK and managed to run this: 我安装了Google Cloud SDK,并设法运行了此程序:

cd D:\path-to-eclipse-workspace\my-project
C:\path-to-google-cloud\gcloud app deploy src\main\webapp\WEB-INF\appengine-web.xml -v v1

The deployment seems to work, but when I check on appspot.com my servlets are not there - I get: Error: Not Found. 部署似乎可以正常工作,但是当我在appspot.com上检查时,我的servlet不存在-我得到: 错误:未找到。 The requested URL /hello was not found on this server. 在此服务器上找不到请求的URL / hello。

Thanks! 谢谢!

Update: 更新:

It looks like Eclipse is not putting .class files in WEB-INF/classes folder, but it creates a build/classes folder in the root of the project. 看来Eclipse并未将.class文件放在WEB-INF / classes文件夹中,而是在项目的根目录中创建了一个build / classes文件夹。

So, should I just copy the classes folder to WEB-INF before deployment or is there a better way to do it? 因此,在部署之前,我应该只将classes文件夹复制到WEB-INF还是有更好的方法?

I ended up doing this: 我最终这样做:

  1. Configure Eclipse to put .class files in WEB_INF/classes folder: 配置Eclipse以将.class文件放入WEB_INF / classes文件夹:

Project Properties -> Java Build Path -> Source -> configure Default output folder to be WEB_INF/classes 项目属性-> Java构建路径->源->将默认输出文件夹配置为WEB_INF / classes

  1. Deploy to App Engine: 部署到App Engine:

cd D:\\path-to-eclipse-workspace\\my-project gcloud app deploy src\\main\\webapp\\WEB-INF\\appengine-web.xml -v v1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM