Using Java 7 with the Official Google Appengine Maven Plugin

I am having trouble using the official Maven and Java 7 plugin with Google Appengine.

Configuration

My project configuration is pom.xml

pretty simple:

In the properties section, I configure:

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

      

And later 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 application: The application contains Java 7 classes, but the -use_java7 flag is not set.

My attempt to solve it

Of course I tried to fix this problem. 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 a flag to the script so that I can use Java 7 (or is there anything else I can do)?

+3


source to share


1 answer


App Engine Java 7 support is currently available for Trusted Tester and is not yet available to the public, you can use Trusted Tester here .

Fortunately, the latest official maven plugin implements this functionality, see 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 config 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>

      

+5


source







All Articles