google-app-engine - 从 Maven 中的计算机属性设置 GAE 应用程序版本
问题描述
我想通过使用maven-build-helper-plugin
regex-property
目标将 Maven POM 版本转换为有效的 GAE 版本字符串(小写,只有字母数字字符和下划线),从 POM 的版本中导出我的 AppEngine 标准应用程序的版本。
所以在POM中我试图这样做:
<groupId>foobar.tests</groupId>
<artifactId>version-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>compute-gae-version</id>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>gae.version</name>
<regex>[^A-Za-z0-9]+</regex>
<value>${project.version}</value>
<replacement>-</replacement>
<failIfNoMatch>false</failIfNoMatch>
<toLowerCase>true</toLowerCase>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<deploy.version>${gae.version}</deploy.version>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</build>
<dependencies>
[...]
</dependencies>
当然它不起作用:应用程序使用默认的时间戳计算版本标签进行部署。我知道这是因为configuration
AppEngine 插件的块在 build-helper 运行之前得到了早期评估。
有没有办法来解决这个问题?
解决方案
我相信这与这篇文章中的问题相同。
mvn build-helper:regex-property appengine:deploy
按照 fboulay 的建议,将配置块移出执行块,并用于部署 GAE 应用程序版本。
推荐阅读
- node.js - 如何迭代包含查询的对象,并全部执行
- android - 无法使用 jniLibs 将 .so 文件添加到 Android Studio 3.5.3
- android - 使用数据绑定和 Kotlin 在 Android 中观察类参数
- google-apps-script - 修改代码 - 删除从单元格引用的一行数据。Google Apps 脚本/Google 表格
- javascript - 如何在 laravel 表视图刀片中显示来自 JSON 的指定对象值
- php - 将网站A的内容显示到网站B而不重定向
- flutter - 固定大小的可滚动容器中的长文本颤动
- dynamics-crm - 在更改字段值时选择业务流程阶段
- java - 哈希图。查找两个哈希映射之间具有相同值的键
- vb6 - VB6无法加载Win10中注册的DLL COM