【问题标题】:'dependencies.dependency.version' for com.google.appengine:appengine-api-1.0-sdk:jar must be a valid version but is '${appengine.target.version}'com.google.appengine:appengine-api-1.0-sdk:jar 的“dependencies.dependency.version”必须是有效版本,但为“${appengine.target.version}”
【发布时间】:2016-09-06 18:30:21
【问题描述】:

我使用命令 mvn archetype:generate 使用 maven 3.3.9 创建了一个项目,然后搜索端点 archtype 并选择它,然后我插入 groupid artifectId version ...等,然后我在 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>

【问题讨论】:

  • 您没有定义 appengine.target.version 属性。查看&lt;properties&gt; 内部,您应该将其添加到那里。你也没有定义appengine.sdk.version。而gcloud.plugin.version 的值是由gcloud.plugin.version 本身定义的,这是行不通的。
  • 知道了 :) 谢谢 tunaki
  • stackoverflow.com/questions/38410322/… 同类型问题。@Tunaki 你能帮我看看如何找到最新的 gcloud.plugin.version 吗?
  • 所以这用于gcloud-maven-plugin Maven 依赖。转到the Maven Central repository,可以在 groupId 和 artifactId 之后浏览到此依赖项。您会收到to this page,您可以在其中按日期查看所有版本。看起来像最新的2.0.9.121.v20160815

标签: java eclipse maven google-app-engine


【解决方案1】:

&lt;properties&gt; 中定义 appengine.target.versiongcloud.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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-21
    • 1970-01-01
    • 2017-05-08
    • 1970-01-01
    • 2011-06-29
    • 2020-08-29
    • 2021-07-30
    相关资源
    最近更新 更多