Google App Engine Java deployment with gcloud skips almost all files

948 views
Skip to first unread message

Thomas Becker

unread,
Jun 15, 2018, 1:09:13 AM6/15/18
to Google App Engine
I am using Google App Engine Standard (Java 8). In the past, I have deployed my app using this command:

.
./appengine-java-sdk/bin/appcfg.sh -A [PROJECT_ID] -V [VERSION_ID] update [WAR_LOCATION]

This still works, both in Ubuntu Linux and (with .cmd instead of .sh) under Windows.
Since app engine management seems to be shifting towards gcloud, today I tried to deploy
using the command

gcloud app deploy [PATH_TO_APPENGINE_WEB_XML] --no-promote --no-stop-previous-version -v [VERSION_ID]

The command prompt displays a summary of what's going to happen and prompts me to continue:

---

Services to deploy:

descriptor: [...]
source: [...]
target project: [...]
target service: [...]
target version: [..]
target url: [...]

(add --promote if you also want to make this service available from
[https://greater-than-zero-hr.appspot.com])

Do you want to continue (Y/n)?

---

When I enter Y, deployment takes place and finishes successfully, the last message at the command prompt being

---

To view your application in the web browser run:
$ gcloud app browse

---

However, almost all of my files are skipped during the upload. The log file (see attachment) has a long list of
skipped files, followed by the information

Incremental upload skipped 97.44% of data

However, no reason for the skipping appears to be given. When I look at my versions, the new version is indeed
uploaded, but it is only ~17MB, whereas the version uploaded with appcfg is ~20MB. When I try to run the new
version, it immediately crashes with a "class not found" error, which is to be expected because my files aren't
there.

At first I thought that this had something to do with path length limits under Windows. However, the exact same
behavior happens under Windows and under Ubuntu Linux. As I said before, for now I'm good using appcfg for deployment
instead of gcloud. But I am worried that the old way of doing it will be discontinued. Therefore, I would like to get
deployment with gcloud to work. Please advise.


22.27.03.409739.log

Kenworth (Google Cloud Platform)

unread,
Jun 15, 2018, 10:14:37 AM6/15/18
to google-a...@googlegroups.com
Per this article, currently the gcloud command-line tool does not deploy Java applications to production App Engine. So if you use the Cloud SDK to develop in Java on App Engine, you must use the Cloud SDK-based Maven or Gradle plugins to deploy applications.

mvn appengine:deploy



Thomas Becker

unread,
Jun 15, 2018, 11:40:31 AM6/15/18
to Google App Engine
Thanks for the information. As a suggestion, you may want to correct the page


On that page, in the example section, it says, To deploy an App Engine Standard Java service, run:

$ gcloud app deploy ~/my_app/WEB-INF/appengine-web.xml

Thomas Becker

unread,
Jun 15, 2018, 1:13:27 PM6/15/18
to Google App Engine
After some more research and experimentation, I believe that I solved the mystery. So again, on the page


is says that you can deploy Java services to App Engine standard with "gcloud app deploy", and on the page


it says that you cannot. On the page


it says that one of the differences between deploying a Java app with appcfg and with "gcloud app deploy"
is that the default for making a jar of the class files was "false" under appcfg, but has changed to "true"
when using "gcloud app deploy". There was a reason why the default used to be "false": the jarring of
the class files changes the class loading order, in a manner that is likely to break apps that use web
frameworks, which is pretty much every app, including mine. So I made "gcloud app deploy" use the
former default behavior by adding

 <staging>
     <enable-jar-classes>false</enable-jar-classes>
 </staging>

to my appengine-web.xml . And Bingo, deploying my Java app to App Engine Standard with "gcloud app deploy"
now works like a charm.

I would like to respectfully request to not change the default values of options. Changing default vaules of options
is likely to cause a lot of people a lot of pain.

George (Cloud Platform Support)

unread,
Jun 16, 2018, 3:29:30 PM6/16/18
to Google App Engine
Hello Thomas, 

There is no contradiction between the two pages you link to, as one page refers to Python apps, the other to Java. 

Your request to not change the default values of options refers to gloud app deploy, a deployment command that is specifically described in documentation as not supported for Java. Your success in using it might be of limited scope, as the same command might not work for another Java application. It is better to follow documentation and deploy Java apps as recommended, namely with Cloud SDK-based Maven, Gradle, Eclipse, or IntelliJ plugins. 

Thomas Becker

unread,
Jun 16, 2018, 3:45:40 PM6/16/18
to Google App Engine

I'm going to have to respectfully disagree with you here. Below is a direct copy and paste from the page


https://cloud.google.com/sdk/gcloud/reference/app/deploy


To deploy an App Engine Standard Java service, run:

  $ gcloud app deploy ~/my_app/WEB-INF/appengine-web.xml

That very clearly refers to Java and not to Python. It tells us to use "gcloud app deploy" to deploy a Java App Engine sevice to the App Engine Standard environment.
On the other hand, the page

https://cloud.google.com/appengine/docs/standard/java/tools/migrating-from-appcfg-to-gcloud

says

Currently, the gcloud command-line tool does not deploy Java applications to production App Engine

I would much appreciate it if you could acknowledge that these two statements are in contradiction to each other.

Sincerely,
Thomas Becker

George (Cloud Platform Support)

unread,
Jun 17, 2018, 2:49:45 PM6/17/18
to google-a...@googlegroups.com
Hello Thomas, 

This is an excellent observation! Grateful for bringing this apparent discrepancy to our attention. The page you refer to might well have to be brought in tune with the others. Why do I mention the other pages? Because all other Java-related pages and tutorials on cloud.google.com, for instance the collection of tutorials linked to on the "Building an App on App Engine" documentation page, and I stress "all", indicate mvn appengine:deploy as the proper command to deploy a Java app. This cannot be a simple coincidence. 

Why do you prefer to use gcloud in spite of the general consensus in favor of Maven? Would this meet a special need of yours? Maven offers other advantages, beside ease of app deployment. 

Thomas Becker

unread,
Jun 18, 2018, 7:07:12 AM6/18/18
to Google App Engine
George,

I'm sure you're right about Maven being the better way to do things. Here's the reason why I haven't gone there. I've been working with the Google App Engine Eclipse plugin since 2010 or so. I recently switched to the new plugin, Google Cloud Tools for Eclipse. After installing that plugin, I was prompted to convert to a Google Cloud Tools project, which I did. Since I wasn't using Maven before, my project was  converted to a non-Maven Google Cloud Tools for Eclipse project. So now what I need to do is convert a non-Maven Google Cloud Tools for Eclipse project to a Maven Google Cloud Tools for Eclipse project. I haven't seen that particular work flow mentioned anywhere in the docs. Any advice, any experience?

Brian de Alwis

unread,
Jun 19, 2018, 8:55:54 AM6/19/18
to google-a...@googlegroups.com
Hi Thomas.

You can deploy your App Engine projects from within Eclipse by selecting the project and using the "Deploy to App Engine Standard…" option in the GCP toolbar item, or by right-clicking on the project and choosing "Deploy to App Engine Standard…".  You can read more at:


Hope that helps.

Brian.


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/ad0a2922-dd35-4983-81f7-1d855ad97047%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thomas Becker

unread,
Jun 19, 2018, 10:10:46 AM6/19/18
to Google App Engine
Thanks, I'll do that then. In the past, I've always deployed from the command line despite the fact that  I was using the Eclipse plugin, but why not doing it from Eclipse and not have to worry. Thanks again for the advice.

Thomas

ABR Arun

unread,
Nov 10, 2018, 7:23:28 PM11/10/18
to Google App Engine
Hi Brian,
      We are deploying GAE Standard Application using eclipse, But one drawback in it is, we couldn't set the Version number if we use eclipse. it deploys to the random number as version

      But If I use "gcloud app deploy " we can mention the versions where it need to be deployed

      Do we have any option to set the version number/name in eclipse ?

Attila-Mihaly Balazs

unread,
Nov 12, 2018, 7:32:47 AM11/12/18
to Google App Engine

Attila

Dan S (Cloud Platform Support)

unread,
Nov 12, 2018, 2:30:43 PM11/12/18
to Google App Engine
Reply all
Reply to author
Forward
0 new messages