Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to use maven for a GAE project, how do i do?

i'm new in the world of GAE. I 'm using eclipse and GAE's SDK, i can deploy to the cloud with the GAE icon and everything is fine. The problem arises when I have to import the infinite number of dependency, then I want to use maven for that. I discovered that there is a special GAE maven plugin called: maven-gae-plugin

Can I use regular maven only to fetch dependencys or I have to use the GAE special plugin to do this?

Thanks

like image 435
McSas Avatar asked Jan 27 '11 13:01

McSas


People also ask

How do I run a Maven project after building success?

Update the App class to use Util class. Now open the command console, go the C:\MVN\consumerBanking directory and execute the following mvn command. After Maven build is successful, go to the C:\MVN\consumerBanking\target\classes directory and execute the following java command. Hello World!

What is Maven project and why is it used?

Maven is a popular open-source build tool developed by the Apache Group to build, publish, and deploy several projects at once for better project management. The tool provides allows developers to build and document the lifecycle framework.


2 Answers

You'll need to define a pom.xml for the project which declares the dependencies.
When you build with maven the dependencies will be downloaded from the remote repositories and stored in you local repository ${userhome}/.m2/repository.
The maven build will also bindle the dependencies in your war file.

The easiest way to get started is by creating a project structure using an archetype.

There are 2 archetypes that I've tried for gae so far:

  1. gae-archetype-gwt, which is built adjacent to the gae-maven-plugin, see this article.
  2. gae-eclipse-maven-archetype, see this article and also note the link at the top of the article for the helios update.

As the name suggests gae-eclipse-maven-archetype has better support for eclipse, I have been finding that the configurations for maven and eclipse have been clashing with each other, which gae-eclipse-maven-archetype goes a long way to alleviate.

If your current project is not using the maven directory structure, then you are going to have an uphill battle. Maven projects are easier to configure if you try to fit in with the defaults which are largely sensible options, rather than going against the grain and having to override all of the default configuration options.

like image 117
crowne Avatar answered Nov 03 '22 13:11

crowne


There is no reason you can't use maven for it's dependency management only. The GAE dependencies are all in maven central.

There is a write up about how to set it up here

I personally use the eclipse plugin in dev and the maven plugin when running under continuous integration.

The main gotcha is to follow the advice about ensuring that the maven dependencies are the last thing in your build path under the GAE plugin dependencies.

like image 27
David Horne Avatar answered Nov 03 '22 13:11

David Horne