• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

GoogleCloudPlatform/appengine-guestbook-java: The guestbook App Engine demo, wri ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

GoogleCloudPlatform/appengine-guestbook-java

开源软件地址(OpenSource Url):

https://github.com/GoogleCloudPlatform/appengine-guestbook-java

开源编程语言(OpenSource Language):

Java 99.5%

开源软件介绍(OpenSource Introduction):

App Engine Java Guestbook

Copyright (C) 2010-2022 Google Inc.

Original Google App Engine Java sample, created in 2009, supporting Google App Engine Standard with Java8, Java11, and Java17 using Bundled Services like App Engine Datastore API,and App Engine Users API. By changine the field in the appengine-web.xml, you can select with Java version to use to execute this Java EE Web App, using Servlet and JSP. It demonstrates that code written back in 2009 with Google App Engine can still serve today with different JVMs.

Prerequisites

Download Maven

These samples use the Apache Maven build system. Before getting started, be sure to download and install it. When you use Maven as described here, it will automatically download the needed client libraries.

Create a Project in the Google Cloud Platform Console

If you haven't already created a project, create one now. Projects enable you to manage all Google Cloud Platform resources for your app, including deployment, access control, billing, and services.

  1. Open the Cloud Platform Console.
  2. In the drop-down menu at the top, select Create a project.
  3. Give your project a name.
  4. Make a note of the project ID, which might be different from the project name. The project ID is used in commands and in configurations.

Setup

Use either:

  • gcloud init
  • gcloud auth application-default login

Google Cloud Shell, Open JDK 11 setup:

To switch to an Open JDK 11 in a Cloud shell session, you can use:

   sudo update-alternatives --config java
   # And select the usr/lib/jvm/java-11-openjdk-amd64/bin/java version.
   # Also, set the JAVA_HOME variable for Maven to pick the correct JDK:
   export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

Development differences between App Engine Java8 and Java11 Bundled Services

The only difference between a Java8 application and a Java11/Java17 application is in the appengine-web.xml file where you need to define the Java11 runtime and declare you need the App Engine APIs:

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <runtime>java11</runtime> <!-- or java17-->
    <app-engine-apis>true</app-engine-apis>
</appengine-web-app>

While the Java17 runtime is in Beta, in order to deploy the application, you can use the beta value for the gcloudMode Cloud SDK parameter like:

 mvn appengine:deploy -Dapp.deploy.gcloudMode=beta

Everything else should remain the same in terms of App Engine APIs access, WAR project packaging, and deployment. This way, it should be easy to migrate your existing GAE Java8 applications to GAE Java11.

Maven

Running locally

    mvn appengine:run

Deploying

    mvn clean package appengine:deploy  -Dapp.deploy.gcloudMode=beta -Ddeploy.projectId=XXXX



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
frescoplaylab/mavenproject发布时间:2022-08-17
下一篇:
jfrog/artifactory-maven-plugin: A Maven plugin to resolve artifacts from Artifac ...发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap