Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven + GAE step-by-step

I'm looking for a basic tutorial on how to "mavenize" a Google AppEngine project, created by Google Eclipse Plugin.

In case that's too difficult, how to create a Maven project, add GAE support to it then import it into Eclipse and work with the GooglePlugin from there?

P.s. What if I wanted SpringMVC,too?

like image 602
Fabio B. Avatar asked Oct 26 '11 12:10

Fabio B.


1 Answers

I'm not sure how to create maven project from eclipse, but creating it from scratch is very easy. For gae you can use net.kindleit:maven-gae-plugin See http://www.kindleit.net/maven_gae_plugin/index.html, it can generate pom.xml for you. Or just use it as

<plugin>
  <groupId>net.kindleit</groupId>
  <artifactId>maven-gae-plugin</artifactId>
  <version>0.8.4</version>
  <configuration>
      <port>8080</port>
      <address>127.0.0.1</address>
  </configuration>
  <executions>
      <execution>
        <id>start-gae</id>
        <goals>
          <goal>stop</goal>
          <goal>unpack</goal>
          <goal>start</goal>
        </goals>
      </execution>
      <execution>
        <id>stop-gae</id>
        <goals>
          <goal>stop</goal>
        </goals>
      </execution>
    </executions>
</plugin> 

but don't forget to add GAE dependencies:

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-1.0-sdk</artifactId>
        <version>${gae.version}</version>
    </dependency>
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-labs</artifactId>
        <version>${gae.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-stubs</artifactId>
        <version>${gae.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-testing</artifactId>
        <version>${gae.version}</version>
        <scope>test</scope>
    </dependency>

and repositories:

<pluginRepositories>
    <pluginRepository>
        <id>maven-gae-plugin-repo</id>
        <name>maven-gae-plugin repository</name>
        <url>http://maven-gae-plugin.googlecode.com/svn/repository</url>
    </pluginRepository>
</pluginRepositories>

<repositories>
    <repository>
        <id>maven-gae-plugin-repo</id>
        <name>maven-gae-plugin repository</name>
        <url>http://maven-gae-plugin.googlecode.com/svn/repository</url>
    </repository>
</repositories>

and then you can generate eclipse config by using mvn eclipse:eclipse

Dev server can be started by mvn gae:run, deployment by mvn gae:deploy

To use Spring, add dependencies to artifacts spring-webmvc, spring-core and spring-context under group org.springframework

like image 153
Igor Artamonov Avatar answered Nov 20 '22 03:11

Igor Artamonov