using the steps below in cloudbuild.yaml file, I am trying to get a java project deployed to google app-engine, each time it is committed to/tagged. It all works fine, except that the version number is auto-generated, and I would like it to be read from the the application pom.xml, where I have the following related tags.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<version>0.1.0-test</version>
<groupId>com.apps</groupId>
<artifactId>cloudbuild-tag</artifactId>
<packaging>war</packaging>
<properties>
<appengine.maven.plugin.version>2.4.0</appengine.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<appId>cloudbuild-tag</appId>
<deploy.version>0-0-1</deploy.version>
<appVersion>0-0-1</appVersion>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<repository.type>git</repository.type>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>16.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.83</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application-->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin.version}</version>
<configuration>
<deploy.projectId>dev</deploy.projectId>
<deploy.version>0-0-1</deploy.version>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.5.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
couldbuild.yaml
- id: 'copy local settings.xml to cloud-build/workspace'
name: gcr.io/cloud-builders/gsutil
args: ['cp', 'gs://bucket-test/settings.xml', 'settings.xml']
- id: 'Stage app using mvn appengine plugin on mvn cloud build image'
name: 'gcr.io/cloud-builders/mvn:appengine'
args: ['--settings', '/workspace/settings.xml','install', 'appengine:stage']
- id: 'Deploy to app engine using gcloud image'
name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', 'target/appengine-staging/WEB-INF/appengine-web.xml']
appengine-web.xml
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>cloudbuild-tag</application>
<service>cloudbuild-tag</service>
<version>0-0-1</version>
<threadsafe>true</threadsafe>
<sessions-enabled>false</sessions-enabled>
<runtime>java8</runtime>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
Appreciate any insight.... thanks very much