Git Product home page Git Product logo

gcloud-maven-plugin's Introduction

deprecated

This plugin has been deprecated. Please migrate to the currently maintained appengine-maven-plugin.

Cloud SDK App Engine Apache Maven Plugin

Apache Maven is a software project management and comprehension tool. It is capable of building WAR files for deployment into App Engine. The App Engine team provides both a plugin and Maven Archetypes for the purpose of speeding up development.

Requirements

To use Maven with Managed VMs, you need to do the following:

  1. Download and install Maven if you don't have it installed.

  2. Install the Google Cloud SDK on your machine. The new Maven plugin goals will not download it automatically on build. Make sure you install an up-to-date version (Beta or later) that has the App Engine Managed VM components installed.

  3. Install the Cloud SDK app-engine-java component:

     gcloud components update app-engine-java
    
  4. If you want to start with a Java Managed VM sample code and tutorial, you can use the GitHub project: https://github.com/GoogleCloudPlatform/appengine-java-vm-guestbook-extras

  5. The Maven plugin relies on configuration done by the cloud SDK. For example, the project name you want to use for a deployment step can be defined with:

    gcloud auth login gcloud config set project

Adding the Cloud SDK App Engine Maven plugin to an existing Maven project

To add the Cloud SDK Google App Engine Maven plugin to an existing Maven project, add the following into the plugins section in the project pom.xml file:

<plugin>
   <groupId>com.google.appengine</groupId>
   <artifactId>gcloud-maven-plugin</artifactId>
   <version>2.0.9.121.v20160815</version>
</plugin>

Compile and build your project using Maven

To build a Java App Engine Web Application using Maven with its pom.xml file:

  1. Change directory to the main directory for your project, for example, guestbook/

  2. Invoke Maven as follows:

     mvn clean install
    
  3. Wait for the project to build. When the project successfully finishes you will see a message similar to this one:

     BUILD SUCCESS
      Total time: 10.724s
      Finished at: Mon Jul 14 14:50:06 PST 2014
      Final Memory: 24M/213M
    
  4. Optionally, run and test the application locally using the Cloud SDK development server, as described in the next section.

Run and test your app with the Cloud SDK development server

During the development phase, you can run and test your app at any time in the development server by invoking the Cloud SDK App Engine Maven plugin.

To run your app in the development server:

  1. Build your app if you haven't already done so:

     mvn clean install
    
  2. Run your app by changing directory to the top level of your project (for example, to myapp) and invoking Maven as follows:

     $ mvn gcloud:run
    
  3. Wait for the the server to start and use your browser to visit http://localhost:8080/ to access your app.

  4. Shut down the app and the development server by pressing Control+C in the Windows/Linux terminal window where you started it, or CMD+C on the Mac.

  5. You can stage the application,i.e create a directory under target/appengine-staging which is ready to be deploy by standard gcloud command with:

     $ mvn gcloud:stage
    

App Engine Maven plugin goals for the Cloud SDK

The App Engine Maven plugin goals have been extended to work with a local Cloud SDK installation that enable Managed VMs development and deployment. These goals are listed in the following sections.

Development server goals

These are the Cloud SDK App Engine development server goals:

Goal Description
gcloud:run Runs the Beta Cloud SDK App Engine development server for Managed VMs applications as well as non Managed VMs application.
gcloud:run_start Performs an asynchronous start for the devserver and then returns to the command line. When this goal runs, the behavior is the same as the run goal except that Maven continues processing goals and exits after the server is up and running.
gcloud:run_stop Stops the development server. Available only if you started the development server with gcloud:run_start.

Available parameters for all gcloud:* goals:

Parameter Description
gcloud_directory The location of the Cloud SDK to use from Maven. (Default is ~/google-cloud-sdk)
gcloud_project The Cloud project you want to work with. (Default is the one set up in the Cloud SDK)
gcloud_app_prefix Defines which gcloud app command you want (i.e preview or beta or nothing). By default, the plugin is excecuting gcloud app, but you can select the prefix to execute gcloud preview app or gcloud beta app.

Available parameters, corresponding to gcloud app run command line flags:

Parameter Description
admin_host The host and port on which to start the admin server (in the format host:port)
allow_skipped_files Make files specified in the app.yaml "skip_files" or "static" clauses readable by the application.
api_host The host and port on which to start the API server for the dev server (in the format host:port).
appidentity_email_address Email address associated with a service account that has a downloadable key. May be None for no local application identity.
appidentity_private_key_path Path to private key file associated with service account (.pem format). Must be set if appidentity_email_address is set.
auth_domain Name of the authorization domain to use
blobstore_path Path to directory used to store blob contents (defaults to a subdirectory of storage_path if not set)
clear_datastore Clear the datastore on startup
datastore_consistency_policy The policy to apply when deciding whether a datastore write should appear in global queries (default is "time")
datastore_path Path to a file used to store datastore contents (defaults to a file in storage_path if not set)
default_gcs_bucket_name Default Google Cloud Storage bucket name
enable_sendmail Use the "sendmail" tool to transmit e-mail sent using the Mail API (ignored if smtp_host is set)
host The host and port on which to start the local web server (in the format host:port)
jvm_flag Additional arguments to pass to the java command when launching an instance of the app. May be specified more than once. Example: <jvm_flag><param>-Xmx1024m</param> <param>-Xms256m</param></jvm_flag>.
log_level The minimum verbosity of logs from your app that will be displayed in the terminal. (debug, info, warning, critical, error) Defaults to current verbosity setting.
logs_path Path to a file used to store request logs (defaults to a file in storage_path if not set)
max_module_instances The maximum number of runtime instances that can be started for a particular module - the value can be an integer, in which case all modules are limited to that number of instances, or a comma-separated list of module:max_instances, e.g. default:5,backend:3
php_executable_path The full path to the PHP executable to use to run your PHP module.
python_startup_script The script to run at the startup of new Python runtime instances (useful for tools such as debuggers)
require_indexes Generate an error on datastore queries that require a composite index not found in index.yaml
show_mail_body Logs the contents of e-mails sent using the Mail API
smtp_allow_tls Allow TLS to be used when the SMTP server announces TLS support (ignored if --smtp-host is not set)
smtp_host The host and port of an SMTP server to use to transmit e-mail sent using the Mail API, in the format host:port
smtp_password Password to use when connecting to the SMTP server specified with smtp_host
smtp_user Username to use when connecting to the SMTP server specified with smtp_host
storage_path The default location for storing application data. Can be overridden for specific kinds of data using datastore_path, blobstore-path, and/or logs_path
use_mtime_file_watcher Use mtime polling for detecting source code changes - useful if modifying code from a remote machine using a distributed file system
custom_entrypoint Specify an entrypoint for custom runtime modules. This is required when such modules are present. Include "{port}" in the string (without quotes) to pass the port number in as an argument. For instance: --custom_entrypoint="gunicorn -b localhost:{port} mymodule:application"
runtime Specify the default runtime you would like to use. Valid runtimes are ['java', 'php55', 'python', 'custom', 'python-compat', 'java7', 'python27', 'go'].

The following example shows how to use some of these settings:

  <plugin>
    <groupId>com.google.appengine</groupId>
    <artifactId>gcloud-maven-plugin</artifactId>
    <version>>2.0.9.121.v20160815</version>
    <configuration>
      <gcloud_directory>/usr/foo/private/google-cloud-sdk</gcloud_directory>
      <verbosity>debug</verbosity>
      <version>specific_version</version>
      <log_level>info</log_level>
      <max_module_instances>2</max_module_instances>
    </configuration>
  </plugin>

Application deployment goal

You can deploy an App Engine Application via the goal gcloud:deploy.

    $ mvn gcloud:deploy

If you want to just produced a deployable stage application directory ready to be used by the Cloud SDK commands, you can use the stage gcloud:stage:

    $ mvn gcloud:stage

the resulting directory will be in the target/appengine-staging directory.

Available parameters, corresponding to gcloud app deploy command line flags:

Parameter Description
compile-encoding Set the encoding to be used when compiling Java source files (default "UTF-8")
delete_jsps Delete the JSP source files after compilation
disable_jar_jsps Do not jar the classes generated from JSPs
enable_jar_classes Jar the WEB-INF/classes content
enable_jar_splitting Split large jar files (> 32M) into smaller fragments
env_vars Environment variable overrides for your app.
force Force deploying, overriding any previous in-progress deployments to this version.
jar_splitting_excludes When enable-jar-splitting is specified and jar_splitting_excludes specifies a comma-separated list of suffixes, a file in a jar whose name ends with one of the suffixes will not be included in the split jar fragments
no_symlinks Do not use symbolic links when making the temporary (staging) directory used in uploading Java apps
retain_upload_dir Do not delete temporary (staging) directory used in uploading Java apps
server The App Engine server to connect to. You will not typically need to change this value.
promote Set the deployed version to be the default serving version.
version The version of the app that will be created or replaced by this deployment.
staging_directory Location of the staging directory. Default is target/appengine-staging/.

Application management goals

The application and project management goals are listed in the following table:

Goal Description
gcloud:enable_debug Configure the specified service in debug mode.
gcloud:disable_debug Configure the specified service in non debug mode.
gcloud:service_start Start the service defined by the maven project.
gcloud:service_stop Stop the service defined by the maven project.

Available parameters corresponding to gcloud app modules command line flags:

Parameter Description
server The App Engine server to connect to. You will not typically need to change this value.
version The version of the app that will be created or replaced by this deployment.

Configuration elements override via the command line interface

Instead of editing the pom.xml with the desired configuration, all the configuration parameters can be defined in the mvn command line, following the simple pattern -Dgcloud.PARAM_NAME=PARAM_VALUE. For example:

  # To start the development server with debug flag:
  $ mvn gcloud:run -Dgcloud.verbosity=debug
  # To start the development server listening to 0.0.0.0 so it can be accessed outside of localhost:
  $ mvn gcloud:run -Dgcloud.host=0.0.0.0:8081
  # To specify a non default Cloud SDK installation directory:
  $ mvn gcloud:run -Dgcloud.gcloud_directory=YOUR_OWN_SPECIFIC_INSTALLATION_PATH
  # To specify the project ID and version at deployment time:
  $ mvn gcloud:deploy -Dgcloud.gcloud_project=myproject  -Dgcloud.version=myversion

Note: The configuration parameters cannot be overriden, due to this Maven bug.

Enterprise Archive (EAR) support

You can use the Cloud SDK Maven plugin on App Engine projects of type war and ear.

gcloud-maven-plugin's People

Contributors

aozarov avatar cedricziel avatar elharo avatar ifigotin avatar ludoch avatar meltsufin avatar seano314 avatar xoob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gcloud-maven-plugin's Issues

Does not work with project_id set by gcloud config

When project id is set implicitly via gcloud config, the gcloud-maven-plugin runs the gcloud executable with the flag --project=null, which overrides the implicitly set project-id and prevents deployment.

Vm:true servlet annotations do not map to root

I am using App Engine Managed VMs (vm:true) and appengine-web.xml
If I put @WebServlet(name = "root", value = "") and try to map a servlet to root url, I will get a null pointer exception
$ mvn clean gcloud:run

Dec 02, 2015 2:22:00 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
SEVERE: Received exception processing /Users/sfan/devrel/samples/cloud/getting-started-java/2-structured-data/target/appengine-staging//WEB-INF/min-quickstart-web.xml
java.lang.NullPointerException

The fix right now is to use a web.xml and map servlet to /

mvn gcloud:deploy failed at this step (Failed to generate quickstart-web.xml.)

Hi

Before yesterday (17 Aug 2015), I use maven plugin version 0.9.56.v20150415a, it's okay work well since 14 April 2015. But yesterday, I can't perform mvn gcloud:deploy anymore, it told me error something. So I decide to upgrade plugin version to 2.0.9.72.v20150804 (And I also tried with latest one - same result). And I run the same procedure again to deploy to production.

It failed at this step
[INFO] Running appcfg --enable_quickstart --disable_update_check -A notused stage /Users/rMBP-SUTTIWAT/Google Drive/Development/EclipseDev/wat/wat-batch/target/wat-batch-0.0.1-SNAPSHOT /var/folders/qm/bf22dtkx6hn419d6m169d0zr0000gn/T/1439866971292-0
Reading application configuration data...

(then successful to read 2 xml file)

(and stop here) Beginning interaction for module wat-batch...
Unable to stage app: Failed to generate quickstart-web.xml.
Please see the logs [/var/folders/qm/bf22dtkx6hn419d6m169d0zr0000gn/T/appcfg1814661144841613477.log] for further information.


And here is partial part of stacktrace ...
Unable to stage:
java.lang.RuntimeException: Failed to generate quickstart-web.xml.
at com.google.appengine.tools.admin.Application.createQuickstartWebXml(Application.java:1330)
at com.google.appengine.tools.admin.Application.populateStagingDirectory(Application.java:695)
at com.google.appengine.tools.admin.Application.createStagingDirectory(Application.java:655)
at com.google.appengine.tools.admin.AppAdminImpl.stageApplication(AppAdminImpl.java:532)
at com.google.appengine.tools.admin.AppAdminImpl.stageApplicationWithDefaultResourceLimits(AppAdminImpl.java:485)
at com.google.appengine.tools.admin.AppCfg$StagingAction.execute(AppCfg.java:2385)
at com.google.appengine.tools.admin.AppCfg.executeAction(AppCfg.java:345)
at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:222)
at com.google.appengine.tools.admin.AppCfg.(AppCfg.java:126)
at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:122)


This is my gcloud info

Suttiwats-MacBook-Pro:wat-batch rMBP-SUTTIWAT$ gcloud info
Google Cloud SDK [0.9.73]

Platform: [Mac OS X, x86_64]
Python Version: [2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]]
Site Packages: [Disabled]

Installation Root: [/Users/rMBP-SUTTIWAT/SDK/google-cloud-sdk]
Installed Components:
core: [2015.08.10]
app-engine-python: [1.9.24]
core-nix: [2015.06.02]
app: [2015.08.10]
gcloud: [2015.08.10]
gsutil-nix: [4.12]
gsutil: [4.13]
bq: [2.0.18]
preview: [2015.08.10]
app-engine-java: [1.9.24]
bq-nix: [2.0.18]
System PATH: [/Users/rMBP-SUTTIWAT/Library/Developer/Xcode/DerivedData/ServiceGenerator-euescrymvkxicqbqkdxuhxqsdtao/Build/Products/Debug:/Users/rMBP-SUTTIWAT/SDK/gae-current-bin:/Users/rMBP-SUTTIWAT/SDK/google-cloud-sdk/bin:/Users/rMBP-SUTTIWAT/SDK/apache-maven-3.2.1/bin:/Applications/Firefox.app/Contents/MacOS/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
Cloud SDK on PATH: [True]

Installation Properties: [/Users/rMBP-SUTTIWAT/SDK/google-cloud-sdk/properties]
User Config Directory: [/Users/rMBP-SUTTIWAT/.config/gcloud]
User Properties: [/Users/rMBP-SUTTIWAT/.config/gcloud/properties]
Current Workspace: [None]
Workspace Config Directory: [None]
Workspace Properties: [None]


Remark: I've tried to use latest release by setting export CLOUDSDK_COMPONENT_MANAGER_SNAPSHOT_URL=https://dl.google.com/dl/cloudsdk/release/components-v0.9.73.json and gcloud components update . I've found at 0.9.73 but not found 0.9.74

Any suggestion to workaround on this? Thanks.

Plugin Doesn't Properly Stop Old Appservers

Sometimes when I run mvn gcloud:run a few times in a row, the process does not fully exit, and the new process fails to stop the app server and thus hangs right at the beginning of the run stage. I workaround this my manually killing the old process using port 8000.

I will try to get you a more easily reproducible bug for this, just a heads up that I've repeatedly run into it.

Error: Bad repository URI

I have a Java Managed VM that when I try to run or deploy it returns the Bad repository URI error. The git repos is correct. That being said this is a multiple module repo where the other modules are normal java app engine modules. I was finally able to get the module deployed by removing the repository setting from the app.yaml file that was created then running:

 gcloud preview app deploy path/to/app.yaml --version [version]

This is obviously not ideal.

mvn versions:check-plugin-updates <- gives wrong results for mvn 3.3.3

[INFO] Require Maven 3.1.0 to use the following plugin updates:
[INFO]   com.google.appengine:gcloud-maven-plugin ......... 2.0.9.74.v20150814
[INFO]

The latest shown in mvnrepository is 2.0.9.81.v20151008

Perhaps this has something to do with <prerequsites> tag asking for 3.1.0 ??

run_start goal does not complete

I'm trying to use the plugin to run an integration test on my application using the following configuration:

      <plugin>
        <groupId>com.google.appengine</groupId>
        <artifactId>gcloud-maven-plugin</artifactId>
        <version>0.9.64.v20150610</version>
        <executions>
          <execution>
            <id>gcloud-start</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>run_start</goal>
            </goals>
          </execution>
          <execution>
            <id>gcloud-stop</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>run_stop</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

The run_start goal does not complete so my tests do not run. The dev server is started and I can curl the application from a separate window but the build just hangs like it is waiting for something. The last info in the log was:

[INFO] Exception in thread Thread-2:
[INFO] Traceback (most recent call last):
[INFO]   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
[INFO]     self.run()
[INFO]   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
[INFO]     self.__target(*self.__args, **self.__kwargs)
[INFO]   File "/Users/jeremy/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py", line 643, in _ListenToLogs
[INFO]     for line in log_lines:
[INFO]   File "/Users/jeremy/google-cloud-sdk/lib/docker/docker/client.py", line 225, in _multiplexed_response_stream_helper
[INFO]     socket = self._get_raw_response_socket(response)
[INFO]   File "/Users/jeremy/google-cloud-sdk/lib/docker/docker/client.py", line 167, in _get_raw_response_socket
[INFO]     self._raise_for_status(response)
[INFO]   File "/Users/jeremy/google-cloud-sdk/lib/docker/docker/client.py", line 119, in _raise_for_status
[INFO]     raise errors.APIError(e, response, explanation=explanation)
[INFO] APIError: 500 Server Error: Internal Server Error ("http: Hijack is incompatible with use of CloseNotifier")
[INFO] 
[INFO] INFO     2015-06-19 15:28:13,254 module.py:1692] New instance for module "default" serving on:
[INFO] http://localhost:8080
[INFO] 
[INFO] INFO     2015-06-19 15:28:13,737 module.py:737] default: "GET /_ah/start HTTP/1.1" 404 1012
[INFO] INFO     2015-06-19 15:28:13,737 health_check_service.py:101] Health checks starting for instance 0.
[INFO] WARNING  2015-06-19 15:28:22,324 containers.py:489] Image Id 38956ca1862f:latest cannot be removed: 404 Client Error: Not Found ("No such image: 38956ca1862f:latest").
[INFO] Try cleaning up old images manually.
[INFO] They can be listed with "docker images".

Static files configured in appengine-web.xml give 404 in the development server

Google Cloud SDK 91.0.1
app-engine-java 1.9.30

I have configured appengine-web.xml to serve static files:

<static-files>
  <include path="/css/*.css" />
</static-files>

I run the following commands:
$ mvn clean
$ mvn gcloud:run

However, when trying to visit http://localhost:8080/css/index.css, it gives me a 404 with an error message specifying that no handlers could be found.

"mvn gcloud:run" uses dev_appserver.py to start the development server. The app.yaml given is from target/simple-service-webapp/WEB-INF/app.yaml. Looking into this file, I see that the static root is being set to static. However, this directory does not exist in target/simple-service-webapp. However, it does exist in target/appengine-staging. In fact, if I copy the dev_appserver.py command and replace simple-service-webapp with appengine-staging, I can reach /css/index.css.

This seems like a bug and that target/simple-service-webapp should have a static directory.

simple-service-webapp.zip

mvn gcloud:deploy - lots of extra noise

It seems the pipe is adding a newline in awkward places.
version 2.0.9.83.v20151021

[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-
[INFO] Updating module [default]...\
[INFO] Updating module [default]...|
[INFO] Updating module [default].../
[INFO] Updating module [default]...-

mvn gcloud:module_delete does not use gcloud.server prop name

I'm having an issue deleting an app in nightly cluster using maven gcloud plugin.

Command ran:
$ mvn gcloud:module_delete -Dgcloud.server=xxx.foo.google.com

Fail log:
[INFO] Running python -S [gcloud path]/gcloud.py --quiet preview app modules delete default --version=pkb-appengine-1c1d3a06
[INFO] ERROR: (gcloud.preview.app.modules.delete) Server responded with code [404]:
[INFO] Not Found Unexpected HTTP status 404
[ERROR] Error: gcloud app command with exit code : 1

Expected:
Run command that looks like:
gcloud.py --quiet preview app modules delete default --version=pkb-appengine-1c1d3a06 --server=xxx.foor.google.com

Maven plugin version: 2.0.9.74.v20150814

mvn gcloud:module_delete is not working

[INFO] Running gcloud app modules...
[INFO] Running python -S /tmp/pkb/google-cloud-sdk/lib/googlecloudsdk/gcloud/gcloud.py --quiet --project=egs-test preview app modules
[INFO] Usage: gcloud preview app modules [optional flags]
[INFO] command may be cancel-deployment | delete | download | get-logs | list
[INFO] | set-default | set-managed-by | start | stop

This is not a complete gcloud command

gcloud plugin fails if invoked on jdk8

I've just tried maven gcloud plugin with java7 appengine app (build is done using 1.7 target); It fails with the following exception if invoked using oracle 8u60 jdk:

[INFO] Oct 16, 2015 6:28:51 AM com.google.appengine.tools.development.devappserver2.StandaloneInstance$StartAction apply
[INFO] SEVERE: Failed to start server
[INFO] java.lang.RuntimeException: Unable to restore the previous TimeZone
[INFO]  at com.google.appengine.tools.development.devappserver2.DevAppServer2Impl.restoreLocalTimeZone(DevAppServer2Impl.java:341)
[INFO]  at com.google.appengine.tools.development.devappserver2.DevAppServer2Impl.doStart(DevAppServer2Impl.java:244)
[INFO]  at com.google.appengine.tools.development.devappserver2.DevAppServer2Impl.access$000(DevAppServer2Impl.java:56)
[INFO]  at com.google.appengine.tools.development.devappserver2.DevAppServer2Impl$1.run(DevAppServer2Impl.java:208)
[INFO]  at com.google.appengine.tools.development.devappserver2.DevAppServer2Impl$1.run(DevAppServer2Impl.java:206)
[INFO]  at java.security.AccessController.doPrivileged(Native Method)
[INFO]  at com.google.appengine.tools.development.devappserver2.DevAppServer2Impl.start(DevAppServer2Impl.java:206)
[INFO]  at com.google.appengine.tools.development.devappserver2.StandaloneInstance$StartAction.apply(StandaloneInstance.java:128)
[INFO]  at com.google.appengine.tools.development.devappserver2.StandaloneInstance$StartAction.apply(StandaloneInstance.java:82)
[INFO]  at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
[INFO]  at com.google.appengine.tools.development.devappserver2.StandaloneInstance.run(StandaloneInstance.java:66)
[INFO]  at com.google.appengine.tools.development.devappserver2.StandaloneInstance.main(StandaloneInstance.java:44)
[INFO] Caused by: java.lang.NoSuchMethodException: java.util.TimeZone.setDefaultInAppContext(java.util.TimeZone)
[INFO]  at java.lang.Class.getDeclaredMethod(Class.java:2130)
[INFO]  at com.google.appengine.tools.development.devappserver2.DevAppServer2Impl.restoreLocalTimeZone(DevAppServer2Impl.java:337)
[INFO]  ... 11 more

Utils getCloudSDKLocation() assumes sdk is installed in home directory

Potential problem with Utils, getCloudSDKLocation() assumes that the google-cloud-sdk in in user.home, and there is no -D switch to override

gcloudDir = System.getProperty("user.home") + "/google-cloud-sdk";
[ERROR] 
org.apache.maven.plugin.MojoExecutionException: Unkown Google Cloud SDK location.
    at com.google.appengine.gcloudapp.AbstractGcloudMojo.setupInitialCommands(AbstractGcloudMojo.java:160)
    at com.google.appengine.gcloudapp.GCloudAppRun.getCommand(GCloudAppRun.java:306)
    at com.google.appengine.gcloudapp.GCloudAppRun.execute(GCloudAppRun.java:292)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)

Quick Solution (hack)

Symbolic link the directory.. in my case I installed google-cloud-sdk under /opt

j~$ mkdir -p /usr/local/share/google/
j:~$ ln -s /opt/google-cloud-sdk /usr/local/share/google/google-cloud-sdk

mvn gcloud:deploy fails for non-vm java app with java6 not supported error

  • gcloud setting app/use_appengine_api set to true
  • gcloud plugin version 2.0.9.81.v20151008

web.xml:
egs-test-qa2truepkb-appengine-e8b372bd1B4_1G

Diagnostic:
INFO] Details: [
[INFO] [
[INFO] {
[INFO] "@type": "type.googleapis.com/google.rpc.DebugInfo",
[INFO] "detail": "[ORIGINAL ERROR] generic::invalid_argument: Java 6 applications are prevented from being deployed to Google App Engine from any version of the SDK, including older ones. If you need to continue to deploy Java 6 applications for compatibility reasons, you can request that your application be whitelisted for Java 6 deployment by visiting http://goo.gl/ycffXq. [google.rpc.error_details_ext] { code: 3 message: "Java 6 applications are prevented from being deployed to Google App Engine from any version of the SDK, including older ones. If you need to continue to deploy Java 6 applications for compatibility reasons, you can request that your application be whitelisted for Java 6 deployment by visiting http://goo.gl/ycffXq." }"
[INFO] }
[INFO] ]
[INFO] ]

Cannot find the Cloud SDK location anymore with version 0.9.88

The Cloud SDK 0.9.88 changed internal location of the cloud.py script which is used by the Maven plugin.
An error:
"Cannot determine the default location of the Google Cloud SDK.
If you need to install the Google Cloud SDK, follow the instructions located at https://cloud.google.com/appengine/docs/java/managed-vms
You can then set it via <gcloud_directory> </gcloud_directory> in the pom.xml"

Is now emitted for all run or deploy commands.

appengine-java-vm-runtime change debian

I tried to install nacl and use nacl to compile other libraries based on the this image, and I have a problem finding the C compiler, and also run into many problems for other libraries. When I changed to debian:testing as the base image, everything works. So I am wondering can I directly use debian:testing as the base image of appengine-java-vm-runtime (instead of google/debian), and then deploy a VM instance? I tried so but it seems I have not be able to successfully deploy it yet. It will be great to get more information from you, thanks!

gcloud needs better error reporting

The Maven gcloud plugin needs better error reporting. No matter how I configure my software stack, mvn gcloud:run reports:

INFO: Successfully processed /Users/apennebaker/Desktop/src/users-ws/users-impl/target/users-impl-1.22.0-SNAPSHOT/WEB-INF/appengine-web.xml
[ERROR] Error: gcloud app xxx exit code is: 1

mvn -X doesn't give any more detail.

mvn gcloud:deploy failing due to missing default DockerFile for java7

"mvn gcloud:run" works and I'm able to hit my website locally.

Attempting to deploy results in an error:

[INFO] Beginning deployment...
[INFO] ERROR: (gcloud.preview.app.deploy) No default Dockerfile for runtime [java7] in the SDK. Use one of the supported runtimes: [python|nodejs|python-compat|java|go|python27|java7].
[ERROR] Error: gcloud app command with exit code : 1

gcloud version: 91.0.0
gcloud-maven-plugin: 2.0.9.90.v20151210

Specification of gcloud_directory not working

specifying in pom.xml via:

<plugin>
  <groupId>com.google.appengine</groupId>
  <artifactId>gcloud-maven-plugin</artifactId>
  <version>${appengine.target.version}</version>
  <configuration>
    <gcloud_directory>${gcloud.directory}</gcloud_directory>
  </configuration>
</plugin>

Currently still results in Unknown Google Cloud SDK location error.

Specifying via command line: mvn gcloud:deploy -Dgcloud.gcloud_directory=$GCLOUD_PATH also results in the same error.

gcloud:deploy fails due to presence of Dockerfile in /tmp/ staging directory when app.yaml's runtime is "java"

Exactly as the title suggests, gcloud:deploy is failing for me because my java app is staged into a subdirectory of /tmp where it has an app.yaml and a Dockerfile generated for it.

The app.yaml:

runtime: java7
vm: True
module: 'mvnhello'
inbound_services:
- warmup
derived_file_type:
- java_precompiled
threadsafe: True
auto_id_policy: default
health_check:
  enable_health_check: True
api_version: '1.0'
handlers:
- url: (/.*)
  static_files: __static__\1
  upload: __NOT_USED__
  require_matching_file: True
  login: optional
...etc...

The Dockerfile:

FROM gcr.io/google_appengine/java-compat
ADD . /app

In this case, it seems generating "runtime: custom" would be more useful in this case, since the Dockerfile already takes care of the runtime by using gcr.io/google_appengine/java-compat as a base image.

Plugin generates app.yaml with env: string

When running mvn gcloud:deploy, it generates app.yaml as following:

runtime: java
env: 2
api_version: 1
threadsafe: True
handlers:
  - url: .*
    script: dynamic

The problem with env: 2 line is that triggers ManagedVM style deployment and not regular (classic) AppEngine deployment.

Is there is any way to generate app.yaml without env: 2 ?

Error while running mvn gcloud:deploy

What steps will reproduce the problem?
I'm following the tutorial created by google in order to understand the use of manged VMs using java.

Here is the link: https://github.com/GoogleCloudPlatform/appengine-java-vm-guestbook-extras

At stage 1 I'm trying to deploy a sample guestBook app which use java libraries that don't run on App Engine. When I use the command mvn gcloud:deploy it told me that the build end with failure and that there is an import error which is : No module named googlecloudsdk.core.util.

What is the expected output? What do you see instead?
I expected the application to be deployed on manged VMs successfully.

Instead I'm seeing this

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building guestbook-stage1 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> gcloud-maven-plugin:2.0.9.81.v20151008:deploy (default-cli) > package @ guestbook-stage1 >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ guestbook-stage1 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Owner\Documents\code\git\google\stage1\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ guestbook-stage1 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ guestbook-stage1 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Owner\Documents\code\git\google\stage1\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ guestbook-stage1 ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ guestbook-stage1 ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ guestbook-stage1 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [guestbook-stage1] in [C:\Users\Owner\Documents\code\git\google\stage1\target\guestbook-stage1-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\Owner\Documents\code\git\google\stage1\src\main\webapp]
[INFO] Webapp assembled in [145 msecs]
[INFO] Building war: C:\Users\Owner\Documents\code\git\google\stage1\target\guestbook-stage1-1.0-SNAPSHOT.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] <<< gcloud-maven-plugin:2.0.9.81.v20151008:deploy (default-cli) < package @ guestbook-stage1 <<<
[INFO]
[INFO] --- gcloud-maven-plugin:2.0.9.81.v20151008:deploy (default-cli) @ guestbook-stage1 ---
[INFO] Creating staging directory in: C:\Users\Owner\Documents\code\git\google\stage1\target\appengine-staging
[INFO] Running appcfg --enable_quickstart --disable_update_check -A notused stage C:\Users\Owner\Documents\code\git\google\stage1\target/guestbook-stage1-1.0-SNAPSHOT C:\Users\Owner\Documents\code\git\google\stage1\target\appengine-staging
Reading application configuration data...

Beginning interaction for module default...
Success.
Temporary staging for module default directory left in C:\Users\Owner\Documents\code\git\google\stage1\target\appengine-staging
[INFO] Running gcloud app deploy...
[INFO] Running python.exe -S C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/lib/googlecloudsdk/gcloud/gcloud.py --quiet preview app deploy C:\Users\Owner\Documents\code\git\google\stage1\target\appengine-staging/app.yaml C:\Users\Owner\Documents\code\git\google\stage1\target\appengine-staging/index.yaml
[INFO] Traceback (most recent call last):
[INFO] File "C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/lib/googlecloudsdk/gcloud/gcloud.py", line 80, in
[INFO] _DoStartupChecks()
[INFO] File "C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/lib/googlecloudsdk/gcloud/gcloud.py", line 72, in _DoStartupChecks
[INFO] from googlecloudsdk.core.util import platforms
[INFO] ImportError: No module named googlecloudsdk.core.util
[ERROR] Error: gcloud app command with exit code : 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.984 s
[INFO] Finished at: 2015-10-29T23:24:50-04:00
[INFO] Final Memory: 16M/222M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.appengine:gcloud-maven-plugin:2.0.9.81.v20151008:deploy (default-cli) on project guestbook-stage1: Error: gcloud app command exit code is: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

What is the output of 'gcloud info'?
Google Cloud SDK [0.9.84]

Platform: [Windows, x86_64]
Python Version: [2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]]
Site Packages: [Disabled]

Installation Root: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk]
Installed Components:
core: [2015.10.23]
app-engine-python: [1.9.27]
bq-win: [2.0.18]
core-win: [2015.10.16]
app: [2015.10.23]
gcloud: [2015.10.23]
windows-ssh-tools: [2015.09.21]
beta: [2015.10.08]
gsutil: [4.15]
bq: [2.0.18]
app-engine-java: [1.9.27]
gsutil-win: [4.15]
System PATH: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin..\bin\sdk;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\Java\jdk1.7.0_79\bin;C:\Program Files\apache-maven-3.3.3\bin;C:\Program Files (x86)\Skype\Phone;C:\Python27;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;;]
Cloud SDK on PATH: [True]

Installation Properties: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\properties]
User Config Directory: [C:\Users\Owner\AppData\Roaming\gcloud]
User Properties: [C:\Users\Owner\AppData\Roaming\gcloud\properties]
Current Workspace: [None]
Workspace Config Directory: [None]
Workspace Properties: [None]

Account: [[email protected]]
Project: [xxxxx]

Current Properties:
[core]
project: [xxxxx]
account: [[email protected]]
disable_usage_reporting: [False]
[app]
use_appengine_api: [True]
[compute]
region: [us-central1]
zone: [us-central1-f]

Logs Directory: [C:\Users\Owner\AppData\Roaming\gcloud\logs]
Last Log File: [C:\Users\Owner\AppData\Roaming\gcloud\logs\2015.10.31\02.49.48.427000.log]

Please provide any additional information below.
I using windows 7, maven 3.3.3
I've followed the exact steps describe in the tutorial. (I've read the tutorial multiple times)
I have to add that the command "mvn gcloud:run" works perfectly, only after I have updated the java component for appengine using the command "gcloud components update app-engine-java". But for some reason the command "mvn gcloud:deploy" has always given me the same error.

Any help will be extremely appreciated, I've been trying to solve this for days

mvn gcloud:deploy does not use local workspace config

Make sure that the gcloud configuration from the current directory makes it into the staging directory, so that when gcloud is called from there it uses the configuration that I am expecting.

See the order via
gcloud help config set
The precedence order is Workspace (based on current working directory) > User (from the user's home directory) > Installation.

Exception message after successful deploy

After I deploy my application, I get the following text logged at the very end:

$ mvn clean package gcloud:deploy
...
[INFO] Total time: 07:25 min
[INFO] Finished at: 2015-07-25T11:52:31-07:00
[INFO] Final Memory: 21M/172M
[INFO] ------------------------------------------------------------------------
Exception in thread "standard-out-redirection-devappserver" java.lang.RuntimeException: The Java Dev Server has stopped.
    at com.google.appengine.gcloudapp.AbstractGcloudMojo$1.run(AbstractGcloudMojo.java:329)
$

Plugin ignores python site packages

gcloud SDK includes a check for 'CLOUDSDK_PYTHON_SITEPACKAGES' variable. If that variable is NOT present, the "-S" option will be added to python interpreter. The maven plugin, on the other hand, uses "-S" all the time, ignoring the fact that site packages may be present.

Need way to specify Java 1.7 compilation for JSPs for App Engine deployment

When following the instructions for using Jenkins on App Engine (https://cloud.google.com/tools/repo/push-to-deploy), I am running into the following issue, which other seem to have hit before:

http://stackoverflow.com/questions/28212570/jsp-being-compiled-in-java-8-on-app-engine

The issue is that the server image for the Jenkins cloud-dev-java tooling executor includes Java 8, which is not compatible with app engine. Setting the compilation version to 1.7 in the mavin compile plugin does not work, as it is the JSP compilation step during the deploy which is causing the problem. I don't know if it is possible to update the jenkins installation to include Java 1.7 on the cloud-dev-java executor, but I wouldn't know how to do it if it is possible.

Would it be possible to add a configuration to the gloud-maven-plugin to direct the JSP compilation phase to target 1.7 class file output?

Queue configuration update

As described here

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/google-appengine/Zb2mnxTDe5g/7a09BIe5EqAJ

the gcloud-maven-plugin seems to not be updating the queue configuration. Given the answers in that thread, I'd assume this maven plugin is the proper place to address this limitation.

It could either run the command suggested in the thread

gcloud preview app deploy app.yaml queue.yaml

or a new goal could be added to just update the queue configuration.

Best regards,

plugin fails if webapp does not have a web.xml

I have a Servlet 3.1 application with no web.xml. When I run mvn gcloud:run I get:

Bad configuration: Could not locate .../target/appengine-plugin-test-0.1-SNAPSHOT/WEB-INF/web.xml
  Caused by: .../target/appengine-plugin-test-0.1-SNAPSHOT/WEB-INF/web.xml (No such file or directory)

Serving static files with a different URL path

I'm trying to use AppEngine to serve a static file through a differently named URL path (myfile.json served at /some_file).

For the other supported languages such as Python, this can be configured through app.yaml (https://cloud.google.com/appengine/docs/python/config/appconfig?hl=en#Python_app_yaml_Static_file_handlers):

handlers:
  - url: /some_file
    static_files: myfile.json
    upload: myfile.json

I can't seem to find an equivalent for appengine-web.xml (https://cloud.google.com/appengine/docs/java/config/appconfig#Java_appengine_web_xml_Static_files_and_resource_files). It can seem to only be configured to serve the file using the filename (myfile.json served at /myfile.json).

Is what I'm trying to do possible with AppEngine and Java?

create-property task does not work on deployment

I stumbled across the create-property task in the gcloud-maven-plugin this morning and have been trying to get it to work.

However, whilst the property is available when filtering resources, i.e. it populates the appengine-web.xml properly, it does not seem to be available when running a deployment. I have the following set up:

<plugin>
    <groupId>com.google.appengine</groupId>
    <artifactId>gcloud-maven-plugin</artifactId>
    <version>0.9.58.v20150505</version>
    <executions>
        <execution>
            <id>create-property</id>
            <goals>
                <goal>create-property</goal>
            </goals>
            <phase>validate</phase>
        </execution>
    </executions>
    <configuration>
        <version>${AppEngineFriendlyVersion}</version>
    </configuration>
</plugin>

If I hard code a version in the property it works fine, but for whatever reason the property generated by the create-property task isn't being seen when it gets to the deployment, and the deployment is just generating the version based off the timestamp.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.