Bad request when updating Appengine with mvn appen

2019-03-16 10:29发布

i'm getting the following error, when I try to update a appengine-application with the appengine-maven-plugin:

400 Bad Request
Error when loading application configuration:
Unable to assign value '1.8.3' to attribute 'version':
Value '1.8.3' for version does not match expression '^(?:^(?!-)[a-z\d\-]{0,62}[a-z\d]$)$'

This is confusing to my because my appengine-web.xml looks like follows:

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>helloworld</application>
    <version>0-0-1</version>
    <threadsafe>true</threadsafe>
    <precompilation-enabled>false</precompilation-enabled>

    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
    </system-properties>
</appengine-web-app>

I'm wondering why appengine-maven-plugin wants to use 1.8.3 as application-version. 1.8.3 is the version of appengine-sdk i want to use. In my POM it's configured as follows:

<dependency>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-api-1.0-sdk</artifactId>
    <version>${appengine.version}</version>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

and later on

<plugin>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-maven-plugin</artifactId>
    <version>${appengine.version}</version>
    <configuration>
        <appVersion>${appengine.app.version}</appVersion>
    </configuration>
</plugin>

${appengine.app.version} points to 1.8.3 I'm using Maven in Version 3.1 and Java 1.7.0_25

What do I wrong? Can anyone help my? Thanks a lot

5条回答
Viruses.
2楼-- · 2019-03-16 11:02

In changed only the pom.xml file by adding the plugin>configuration>version tag (per below)...

<plugin>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-maven-plugin</artifactId>
    <version>${project.appengine.version}</version>
    <configuration>
      <port>8888</port>
     *<version>${app.version}</version>*
    </configuration>
</plugin>
查看更多
爷的心禁止访问
3楼-- · 2019-03-16 11:06

If you generated the project with the archetype skeleton, like I did, and you have a block similar to

<properties>
    <app.id>MY-GAE-PROJECT-ID</app.id>
    <app.version>1</app.version>
    <appengine.version>1.9.20</appengine.version>
    <gcloud.plugin.version>0.9.58.v20150505</gcloud.plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

in your pom.xml and your appengine-web.xml looked like

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>${app.id}</application>
<version>1</version>
etc....

when it got made, then, modify appengine-web.xml to be ${app.version} because they so helpfully already added that property with the archetype but never used it anywhere. Then, update your pom.xml's app.version to be your appropriate version (if you don't use "1"). Then, scroll down in the pom.xml to where you see

            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-maven-plugin</artifactId>
            <version>${appengine.version}</version>
            <configuration>
                <enableJarClasses>false</enableJarClasses>

and inside the configuration block there add

                <version>${app.version}</version>
查看更多
男人必须洒脱
4楼-- · 2019-03-16 11:20

I had the same issue as you described. When I added the "version" element in the configuration element, with value pointing to the version of the app in my appengine-web.xml file, mvn appengine:update completed successfully. (maven v3.1.0, appengine plugin v1.8.3)

in pom.xml:

....
<plugin>
   <groupId>com.google.appengine</groupId>
   <artifactId>appengine-maven-plugin</artifactId>
   <version>${appengine.version}</version>
   <configuration>
      <version>MY-VERSION</version>
   </configuration>
</plugin>
...

in appengine-web.xml:

...
<version>MY-VERSION</version>
...

查看更多
Viruses.
5楼-- · 2019-03-16 11:26

Try to change appengine-web.xml entry from <version>0-0-1</version> to <version>1</version>. Regards, Adam.

查看更多
再贱就再见
6楼-- · 2019-03-16 11:26

The way I solved this issue was trivial in my console I executed mvn clean install and then the appcfg.cmd -A [your app] update target\appengine-try-java-1.0 command.

查看更多
登录 后发表回答