App Engine standard java 11 to java 17 migration
Java 11 on App Engine in Google Cloud will soon reach its end of support. Below are the steps to migrate your Java 11 application to Java 17 on App Engine.
If you need any help with the migration steps, feel free to ask!
src/main/webapp/WEB-INF/appengine-web.xml : update
<runtime>java11</runtime> to <runtime>java17</runtime>
pom.xml: update
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>3.10.1</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archiveClasses>true</archiveClasses>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>.gitlab-ci.yml : https://gitlab.com/eshopbox-team/esb-client-order-return/-/blob/staging_java17/.gitlab-ci.yml
image: registry.gitlab.com/eshopbox-team/devops/custom-image/java-17-mvn-3.9.9:bullseye
APP ENGINE java 17 Deployed service: https://console.cloud.google.com/appengine/versions?serviceId=order-return&project=eshopbox-portal-dev&cloudshell=false
Merge request details: https://gitlab.com/eshopbox-team/esb-client-order-return/-/merge_requests/1109/diffs
Troubleshooting: "Python not found" Error in CI/CD Pipeline During Migration to Java 17
When migrating to Java 17, you might encounter the following error during the CI/CD pipeline execution:
/root/.cache/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/install.sh: 216: python: not found
Cause:
This error occurs because the Google Cloud SDK relies on Python to run certain scripts and commands during deployment. The base image used in the pipeline (java-17-mvn-3.9.9:bullseye
) does not have Python pre-installed, which leads to the failure of the deployment process.
Solution:
To resolve this issue, you need to install Python and the necessary dependencies within your pipeline configuration file (e.g., .gitlab-ci.yml
). Add the following lines under the before_script
section of your .yml
file:
before_script:
- apt-get update -y
- apt-get install -y python3 # Install Python 3
- apt-get install -y python3-distutils # Ensure Python distutils is available for SDK operations
These commands will ensure that Python and its essential components are available for the Google Cloud SDK to function correctly in the CI/CD environment.