Using Java 7 with official Google Appengine Maven plugin

你说的曾经没有我的故事 提交于 2019-12-10 19:12:52

问题


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

Configuration

My project configuration pom.xml is quite simple:

In the properties section I configure:

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

And later on I use the plugin:

<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>

Error message

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

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

or

mvn appengine:update -D--use_java7

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

How do I pass the flag to the script, so that I can use Java 7 (or is there anything else I can do)?


回答1:


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

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");
}

... ...

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>


来源:https://stackoverflow.com/questions/14675058/using-java-7-with-official-google-appengine-maven-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!