7

I have a project in eclipse, a java app with appengine sdk and maven as my builder.

The .class files are not refreshed until i launch clean install, so every change i do in code i have to run:

  • mvn clean install
  • mvn eclipse:clean
  • mvn eclipse:eclipse

and then try to launch my app.

Help me please it's really annoying. Thanks

Alejohuertas
  • 81
  • 1
  • 1
  • 5
  • 2
    Have you tried just running `mvn compile`? It's not clear to me if you are having problems because you are unfamiliar with Maven or is there something special about your build process that requires running the `install` phase. – matt b Aug 31 '12 at 20:57
  • Which version of the maven-compiler-plugin do you use? Which Maven version do you use? Why do you use mvn eclipse:eclipse and not m2e plugin in Eclipse ? – khmarbaise Sep 02 '12 at 11:02
  • Actually I'm using the apache-maven-2.2.1 installation. I config the eclipse in such a way that the maven plugin uses this installation. I think my problem is that the pom is not well built. – Alejohuertas Sep 10 '12 at 13:34
  • I can refresh the code in the deployment only by mvn install, and then mvn eclipse:eclipse. But does the code not automatically refresh after save a java file? it's like the build is not working. – Alejohuertas Sep 10 '12 at 21:02

4 Answers4

1

You are probably looking for a hot deployment feature. When working wit ha webapp, in most cases it is not enough just to compile a java class - usually you have to create a war package, and nearly always you have to redeploy the new code to the app server.

mvn package should be enough to create the war. You don't need to run mvn clean as long as you don't remove or rename any file. That would make things faster.

To achieve hot deployment (i.e. to get the new code instantaneously on the web-engine dev server) you need to do do some extra work, however. Make sure you use the Google Plugin for Eclipse - you can use it along with maven. The plugin at least should take care of static files hot deployment. Running the application in debug mode with Eclipse helps a bit as well as it is capable of replacing the methods' bodies on the fly.

Find further information answers to this question.

Marek Dec
  • 954
  • 6
  • 8
  • I'm actually using the eclipse plugin, and there's obviously a pom specifying the building characteristics, ad mvn runs it. I try the solution given in the post related ...modifiyng the web_apengine.xml (manually) and then relaunching the app but nothing happens; the code i change in the app is not show – Alejohuertas Sep 05 '12 at 19:30
1

I know this is a very old post but I recently came across this issue while working with STS and Websphere application server. Hope this helps anyone to come across this ancient relic of a post.

Have a look at the "FileSync" plugin in the Eclipse marketplace. It allows to sync your workspace files with external directories (think your application server). After you install "FileSync" you can configure it to "copy/paste" your workspace files directly to your application server's exploded .war directory. It might take a little playing around with to get your files copied in a j2ee compliant format but it worked like a charm for me. Once its configured you basically just update files, save them, and your application is ready to go!

Jason
  • 1,371
  • 4
  • 21
  • 44
  • Thanks for suggesting this plugin! It solved my problem and after quick configuration JPS files are now auto update to app directory! I don't need to restart tomcat any more! :) IF ANYONE CAN'T FIND WHERE TO CONFIGURE FILESYNC, THEN DO THIS: Right click on your Eclipse project > Properties > File synchronization. – Eugenijus S. Nov 08 '17 at 13:30
0

It's unclear from the question exactly what is happening and why. To figure this out, we would need to see the pom.xml and the "tree" command output showing the relevant folders and files. Then we could compare that to what the relevant maven plugin should be doing, and work from there.

As it stands, this is a quite old question in which it's unclear exactly what's happening, and OP has disappeared a long time ago. If this issue occurred today, the best thing to do would be to post to the App Engine Public Issue Tracker, although this could be inappropriate if the issue weren't in the App Engine SDK (or related maven plugins) but came from a third-party maven plugin not behaving properly (maven-compiler-plugin, for example). However, until a more in-depth analysis were performed, it would be difficult to know in advance.

Nick
  • 3,581
  • 1
  • 14
  • 36
0

Getting hot-reload of your App Engine application working is easy using only the Eclipse m2e plugin actually, and doesn't require the GPE plugin or any other special connectors:

1) Create your App Engine app as a Maven project in Eclipse as you would normally, using one of the provided Google archetypes or another custom archetype.

2) Configure your project, and do an initial build with mvn clean install in the root of the project to create the initial target/<artifact>-<version> WAR directory.

3) Start the development server with mvn appengine:devserver in the project root and ensure you can view your locally served app in a browser. Leave the development server running.

4) In Eclipse, make sure that Project -> Build automatically is checked.

Now, whenever you save a .java file Eclipse will automatically build the corresponding .class file under target/<artifact>-<version>/WEB-INF/classes. In a Maven project, this directory is set as the output directory for classes in your .classpath. The development server will detect the file change and do a hot-reload of your application so that the changes will appear immediately when you refresh your app in the browser.

Adam
  • 5,697
  • 1
  • 20
  • 52