| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This sample demonstrates migrating a WAR packaged servlet to Java 11. To migrate to the Java 11 runtime, your application must have a Main class that starts a web server. This sample is dependent on artifact appengine-simple-jetty-main to provide a Main class that starts an embedded Jetty server.
The pom.xml has been updated accordingly:
<properties> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> <failOnMissingWebXml>false</failOnMissingWebXml> </properties>
<dependency> <groupId>com.example.appengine</groupId> <artifactId>simple-jetty-main</artifactId> <version>1</version> <scope>provided</scope> </dependency>
Note: this dependency needs to be installed locally.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/appengine-staging
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
The appengine-web.xml file has been removed and an app.yaml has been added to manage your application settings:
runtime: java11 entrypoint: 'java -cp "*" com.example.appengine.jetty.Main helloworld.war'
The exec-maven-plugin has been added to appengine-simple-jetty-main so you can run your application locally.
mvn clean package
cd ../appengine-simple-jetty-main
mvn install
mvn exec:java -Dexec.args="../helloworld-servlet/target/helloworld.war"
Then visit: http://localhost:8080/hello
While in the helloworld-servlet directory, use the appengine-maven-plugin to deploy your app:
mvn clean package appengine:deploy
Then visit: https://YOUR-PROJECT-ID.appspot.com/hello
| Back | FazBrowse Home | New Git URL |