hot reload: mvn google cloud sdk

95 views
Skip to first unread message

Rajesh G

unread,
Apr 16, 2022, 7:50:43 AM4/16/22
to google-a...@googlegroups.com
Hello,
I have created a simple java appengine using maven archetypes.
I am not using eclipse (because I don't have eclipse in windows wsl2.)

I run the server using
mvn appengine:run

Then I do simple changes to a servlet. Then another window, I run 
mvn:compile.  It compiles into the target/snapshot folder

However, I am not seeing the changes on the server.  The latest servlet changes is not reflected 

I tried the following settings also in the pom.xml file.  The server is not restarted
<configuration>
  <automaticRestart>true</automaticRestart>
</configuration>

--
Support Team
Field Service Software on Google Cloud Platform and Mobile


Ludovic Champenois

unread,
Apr 16, 2022, 12:50:15 PM4/16/22
to Google App Engine
Hi,
Almost there,  I think you are missing this critical line in your pom.xml:
    <build>
        <outputDirectory>target/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>
        <plugins>
...

This way, the compile on save is put the changed class in the correct web app location.
At least, I tested it in NetBeans and it works great as NetBeans can do compile automatically when you save a java file, even in the Maven project.
Ludo

Rajesh G

unread,
Apr 19, 2022, 11:43:04 PM4/19/22
to google-a...@googlegroups.com
Hi, any ideas on how to make the hot reload work 

Thanks

Ludovic Champenois

unread,
Apr 20, 2022, 5:51:47 AM4/20/22
to google-a...@googlegroups.com
Hi,
Try to follow the doc at:
Especially the config for the Pom.xml file to put the classes in the correct folder.

Thanks


--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/5XT9ASv7iM4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/CA%2BS7ijaEYSV83h6rvK-NDF8bpTw%3Dx31cSrtzmZExufXu%3DP%3DqzQ%40mail.gmail.com.

Rogelio Monter Rodriguez

unread,
Apr 20, 2022, 3:26:36 PM4/20/22
to Google App Engine

As stated in the app-maven-plugin User guide:

    To enable automatic reload of an application, you must tell the Dev App Server to scan for changes :

    <configuration>

      <automaticRestart>true</automaticRestart>

    </configuration>

    While your app is running, just run mvn war:exploded to reflect your changes into the running application.

Rajesh G

unread,
Apr 21, 2022, 5:50:55 AM4/21/22
to google-a...@googlegroups.com
mvn war:exploded did not work.

However, mvn compile is working now and the server will restart. It did not when I tried earlier.

Cheers

You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/d4855b59-c9d5-4eab-9678-ac19094529afn%40googlegroups.com.

Rajesh G

unread,
Apr 21, 2022, 5:55:39 AM4/21/22
to google-a...@googlegroups.com
If you dont' use IDE  like eclipse or netbeans (it is not available on windows 11 wsl2 env)
Use mvn compile.
It is working for me now on windows 11.  I will try on wsl2 later.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.

Ludovic Champenois

unread,
Apr 21, 2022, 11:14:03 AM4/21/22
to 'Rajesh G' via Google App Engine

Hi,

You can install InteliJ on wsl2 according to https://nirisarri.github.io/2020-11-03-how-to-install-and-run-intellij-idea-for-linux-in-wsl2/

similar steps should work for NetBeans or Eclipse I guess.

Ludp

You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/5XT9ASv7iM4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/CA%2BS7ijY2QAOGaP%2B38XD4To%3DUiqyDWNx44_S6PvVcLdU%2BU3yWtg%40mail.gmail.com.

Rogelio Monter Rodriguez

unread,
Apr 21, 2022, 6:24:54 PM4/21/22
to Google App Engine

This gist on GitHub provides a summary on how to run Eclipse on WSL2.

For Netbeans, as shown on this StackOverflow answer, there’s only a workaround.


Also, this tutorial could be useful for Using WSL 2 to develop Java applications on Windows.

Reply all
Reply to author
Forward
0 new messages