Google App Engine, Maven and Eclipse development setup

I'll try keep this short. I have Eclipse with an installed M2E (Maven to Eclipse) plugin. I have a GAE (Google App Engine) project I'm working on. Everything is working ok apart from one really annoying thing: I have to stop/start the devserver every time I make a change.

If you have any experience with this setup then you might be able to answer this simple question?

I start the development server with "mvn appegnine:devserver" on the command line. Now I would expect that if I made changes to a *.jsp for example that those changes would automatically be updated on the devserver. Is this what happens with you?

I have noticed that if I make changes to *.jsp files under my target folder then devserver will see those changes and updates as I would expect. I think my problem lies with Eclipse not copying changes to target folder, but not sure if is even suppose to?

Does anyone have any suggestions on how I should progress investigating this? I've ran out of ideas :-/

I thank you in advance for any comments you may have.

P.s I know I can run "mvn package" to update files, but this is slow and the devserver runs out of memory after a do it twice.

Upvotes: 3

Views: 1327

Answers (4)

Aniruddha Das
Aniruddha Das

Reputation: 21698

The below point worked for me.

Ensure on the order and export tab that the appengine dependencies are above the maven dependencies.

Upvotes: 0

A.C.Andreani
A.C.Andreani

Reputation: 31

You can use rsync like this:

     rsync -r --existing   src/main/webapp/ target/ROOT

where "ROOT" is the project build finalName.

Upvotes: 0

filipenos
filipenos

Reputation: 11

I have the same problem as you, however I resolved with other way. I use FileSync plugin (which can be found in the market place). With this plugin you configure an input directory (webapp) and output directory (target). Any change made to the webapp will be passed to the target. I have helped too.

Upvotes: 1

Nick
Nick

Reputation: 1822

This can be little painful, depending on how you want to work and which version of eclipse you're using.

  1. Install the m2e-wtp plugin if you haven't. It's the secret sauce that makes appengine projects work in eclipse. Note this isn't m2e - but another plugin.

  2. Install the GPE - the google plugin for eclipse if you haven't

  3. Make sure your project is being managed by m2e as a maven project.

  4. Go into your project properties - enable it as an appengine project using the GPE (listed under 'Google'). Don't forget to tick HRD while you're here.

  5. Go to your project build path (Properties -> Java Build Path).

    • Ensure on the source tab that your src/main/resources doesnt have an ** exclusion.
    • Ensure on the libraries tab your have the three libraries 'JDK', 'Google Appengine' and 'Maven Dependencies' and nothing else
    • Ensure on the order and export tab that the appengine dependencies are above the maven dependencies.

It sounds pretty ridiculous - i'm not really sure why its still so painful, but that is a good recipe for success. Once that's done, this should allow you to run in debug from eclipse itself, with hotloading of code, jsps, css, scripts etc. I've had this work in helios, indigo and juno.

You can read more about the m2e-wtp setup instructions here. They refer to GWT but it's the same for appengine (I'm not sure why the emphasis on using GWT on GAE) because its actually about the correct setup of GPE and Maven.

You will also find that you may need to repeat some parts of step 5 pretty frequently - if your app isn't loading properly take a quick look to ensure that your resources haven't been excluded. This happens when you update your project configuration using the m2e plugin.

The wtp-m2e plugin updates the target folder as resources modified - so this should also resolve your issues running from the command line, but i can't vouch for that - I prefer to run straight out of eclipse.

Upvotes: 3

Related Questions