在官方的Google Appengine Maven插件中使用Java 7 [英] Using Java 7 with official Google Appengine Maven plugin

查看:123
本文介绍了在官方的Google Appengine Maven插件中使用Java 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我无法使用官方Maven Plugin 和Java 7与Google Appengine。 $ b

I'm having trouble using the official Maven Plugin and Java 7 with Google Appengine.



b

我的项目配置 pom.xml 非常简单:

在属性部分我配置:

In the properties section I configure:

<gae.version>1.7.4</gae.version>

后来我使用插件:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>2.3.2</version>
  <configuration>
    <source>1.7</source>
    <target>1.7</target>
  </configuration>
</plugin>
<plugin>
  <groupId>com.google.appengine</groupId>
  <artifactId>appengine-maven-plugin</artifactId>
  <version>${gae.version}</version>
</plugin>



错误信息



每当我运行 mvn appengine:update 出现以下错误:

Error message

Whenever I run mvn appengine:update I get the following error:


无法更新应用程式:The应用程序包含Java 7类,但--use_java7标志尚未设置。

Unable to update app: The application contains Java 7 classes, but the --use_java7 flag has not been set.



我试图解决它



当然,我试图解决这个问题。运行

My attempt to solve it

Of course, I tried to fix this issue. Running

mvn appengine:update --use_java7

mvn appengine:update -D--use_java7

没有帮助,因为该标记不用于Maven插件,而是用于 appcfg 脚本。

didn't help, because the flag is not used for the Maven plugin, but instead for the appcfg script.

如何将标志传递给脚本,以便我可以使用Java 7否则我可以做到)?

推荐答案

App Engine Java 7支持目前用于可信测试人员,但是,您可以在此处应用受信任的测试人员。

App Engine Java 7 Support is currently for Trusted Tester and not available to public yet, you can apply Trusted Tester at here.

幸运的是,最新的官方maven插件确实实现了该功能,请参阅AbstractAppCfgMojo.java

Fortunately the latest official maven plugin does implement this feature, see the AbstractAppCfgMojo.java:

... ...

/**
 * Use the App Engine Java 7 runtime for this app.
 *
 * @parameter
 */
protected boolean useJava7;

... ...

if (useJava7) {
  arguments.add("--use_java7");
}

... ...

您可以在pom.xml中使用以下插件配置来启用Java7支持:

You can use the following plugin configuration in pom.xml to enable Java7 support:

</build>
  <plugins>
    ... ...
    <plugin>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-maven-plugin</artifactId>
      <version>${gae.version}</version>
      <configuration>
        <useJava7>true</useJava7>
      </configuration>
    </plugin>
  </plugins>
</build>

这篇关于在官方的Google Appengine Maven插件中使用Java 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆