com.google.appengine的'dependencies.dependency.version':appengine-api-1.0-sdk:jar必须是有效版本,但是'$ {appengine.target.version}'

时间:2016-09-06 18:30:22

标签: java eclipse maven google-app-engine

我使用命令mvn archetype使用maven 3.3.9创建了一个项目:generate然后搜索端点archtype然后选择然后我插入groupid artifectId版本...等之后我在Eclipse Neon和As中导入这个项目我正在运行这个项目appengine:devserver命令我收到错误信息

 Resolving expression: '${gcloud.plugin.version}': Detected the following recursive expression cycle in 'gcloud.plugin.version':    [gcloud.plugin.version] -> [Help 2]
[ERROR]     Resolving expression: '${gcloud.plugin.version}': Detected the following recursive expression cycle in 'gcloud.plugin.version': [gcloud.plugin.version] -> [Help 2]
[ERROR]     'dependencies.dependency.version' for com.google.appengine:appengine-api-1.0-sdk:jar must be a valid version but is '${appengine.target.version}'. @ line 34, column 13
[ERROR]     'dependencies.dependency.version' for com.google.appengine:appengine-endpoints:jar must be a valid version but is '${appengine.target.version}'. @ line 39, column 13
[ERROR]     'dependencies.dependency.version' for com.google.appengine:appengine-testing:jar must be a valid version but is '${appengine.sdk.version}'. @ line 69, column 13
[ERROR]     'dependencies.dependency.version' for com.google.appengine:appengine-api-stubs:jar must be a valid version but is '${appengine.sdk.version}'. @ line 75, column 13
[ERROR]     'build.plugins.plugin.version' for com.google.appengine:appengine-maven-plugin must be a valid version but is '${appengine.sdk.version}'. @ line 122, column 14
[ERROR]     'build.plugins.plugin.version' for com.google.appengine:gcloud-maven-plugin must be a valid version but is '${gcloud.plugin.version}'. @ line 145, column 14
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
 [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/InterpolationCycleException

下面给出了生成的POM.xml文件。我不知道为什么我会收到此错误以及如何解决它。从最初的错误读取我得到了{{gcloud.plugin.version}}的信息有问题,但问题是什么,我该如何解决这个问题。

<?xml version="1.0" encoding="UTF-8"?>
<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">

<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>

<groupId>com.demo.app</groupId>
<artifactId>demo-app</artifactId>

<properties>
    <app.id>your-app-id</app.id>
    <app.version>1</app.version>
    <appengine.version>${appengine.sdk.version}</appengine.version>
    <gcloud.plugin.version>${gcloud.plugin.version}</gcloud.plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
    <archiveClasses>true</archiveClasses>
</properties>

<prerequisites>
    <maven>3.3.9</maven>
</prerequisites>

<dependencies>
    <!-- Compile/runtime dependencies -->
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-1.0-sdk</artifactId>
        <version>${appengine.target.version}</version>
    </dependency>
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-endpoints</artifactId>
        <version>${appengine.target.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>

    <!-- Test Dependencies -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>2.0.2-beta</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-testing</artifactId>
        <version>${appengine.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-stubs</artifactId>
        <version>${appengine.version}</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>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>display-dependency-updates</goal>
                        <goal>display-plugin-updates</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <webXml>${project.build.directory}/generated-sources/appengine-endpoints/WEB-INF/web.xml</webXml>
                <webResources>
                    <resource>
                        <!-- this is relative to the pom.xml directory -->
                        <directory>${project.build.directory}/generated-sources/appengine-endpoints</directory>
                        <!-- the list has a default value of ** -->
                        <includes>
                            <include>WEB-INF/*.discovery</include>
                            <include>WEB-INF/*.api</include>
                        </includes>
                    </resource>
                </webResources>
            </configuration>
        </plugin>

        <plugin>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-maven-plugin</artifactId>
            <version>${appengine.version}</version>
            <configuration>
                <enableJarClasses>false</enableJarClasses>
                <version>${app.version}</version>
                <!-- Comment in the below snippet to bind to all IPs instead of just 
                    localhost -->
                <!-- address>0.0.0.0</address> <port>8080</port -->
                <!-- Comment in the below snippet to enable local debugging with a remote 
                    debugger like those included with Eclipse or IntelliJ -->
                <!-- jvmFlags> <jvmFlag>-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n</jvmFlag> 
                    </jvmFlags -->
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>endpoints_get_discovery_doc</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>com.google.appengine</groupId>
            <artifactId>gcloud-maven-plugin</artifactId>
            <version>${gcloud.plugin.version}</version>
            <configuration>
                <set_default>true</set_default>
            </configuration>
        </plugin>
    </plugins>
</build>

1 个答案:

答案 0 :(得分:1)

<properties>中定义 appengine.target.version gcloud.plugin.version 属性。您可以使用https://cloud.google.com/sdk/downloads

google最新版本的appengine-sdk和gcloud.plugin.version
 <appengine.version>1.9.42</appengine.version>
        <gcloud.plugin.version>124</gcloud.plugin.version>