App Engine FLEX Maven项目:过滤app.yaml文件

时间:2019-03-21 09:34:21

标签: java maven google-app-engine app-engine-flexible

我有一个基于带有运行时Java的Google App Engine FLEX的Maven项目。在这个项目中,我有2个配置文件,一个用于测试环境,一个用于生产环境:

<profiles>
    <profile>
        <id>test</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <!-- profile conf -->
            <profile.id>test</profile.id>
            <!-- build config -->
            <app.deploy.project>my-test-project</app.deploy.project>
            <app.deploy.promote>true</app.deploy.promote>
            <!-- project config -->
            <project.config.service>my-service-name-1</project.config.service>
            <project.config.host>d</project.config.host>
            <project.config.username>e</project.config.username>
        </properties>
    </profile>
    <profile>
        <id>production</id>
        <properties>
            <!-- profile conf -->
            <profile.id>production</profile.id>
            <!-- build config -->
            <app.deploy.project>my-production-project</app.deploy.project>
            <app.deploy.promote>false</app.deploy.promote>
            <!-- project config -->
            <project.config.service>my-service-name-2</project.config.service>
            <project.config.host>a</project.config.host>
            <project.config.username>b</project.config.username>
        </properties>
    </profile>
</profiles>

这是我当前的src/main/appengine/app.yaml文件:

runtime:    java
env:        flex
threadsafe: true
service:    ${project.config.service}

handlers:
- url: /.*
  script: this field is required, but ignored
  secure: always

automatic_scaling:
  min_num_instances: 1
  max_num_instances: 20

env_variables:
  host: "${project.config.host}"
  username: "${project.config.username}"

由于此文件(过滤后)需要保存在target\appengine-staging文件夹中,因此我无法创建正确的Maven配置来过滤文件并将其创建在正确的文件夹下。

由于它不是resource文件,因此<resources>的{​​{1}}部分不适用。另外,具有过滤配置的pom.xml也不适用,因为此文件不会进入war文件本身。

我尝试过这样的事情

maven-war-plugin

但是<plugin> <artifactId>maven-war-plugin</artifactId> <version>3.1.0</version> <configuration> <archiveClasses>true</archiveClasses> <webResources> <resource> <directory>${basedir}/src/main/appengine</directory> <includes> <include>app.yaml</include> </includes> <filtering>true</filtering> <targetPath>../appengine-staging</targetPath> </resource> </webResources> </configuration> </plugin> 从WAR目录开始,没有选择其他文件夹的可能。有没有办法正确过滤此文件?

0 个答案:

没有答案