Create an executable JAR

105 views
Skip to first unread message

Craig Mitchell

unread,
Jan 27, 2024, 8:54:48 PM1/27/24
to GWT Users
Hi,

Using the SpringBoot archetype ( https://github.com/NaluKit/gwt-maven-springboot-archetype ), I can happy run mvn clean package and get a war file that has everything and runs nicely on a web server.

If I then modify mywebapp-server/pom.xml to have:
<packaging>jar</packaging> 
(instead of war)

I then get an executable jar, which I can run:
java -jar mywebapp-server/target/mywebapp.jar

The executable JAR runs the embedded Tomcat server, which contains the index.html + css (inside the mywebapp.jar in BOOT-INF\classes\public), however, all the GWT files are in BOOT-INF\lib\mywebapp-client-HEAD-SNAPSHOT.war) so it never sees them.  As a result, the app only shows the html, and nothing else works.

Has anyone made a GWT app as an executable JAR?  Or any suggestions how to do it?

The reason I need an executable JAR, is because that's all Google App Engine standard supports: https://cloud.google.com/appengine/docs/standard/testing-and-deploying-your-app?tab=java

Thanks in advance.

Craig Mitchell

unread,
Jan 28, 2024, 12:18:05 AM1/28/24
to GWT Users
Apologies.  I've now realised I don't need to create an executable JAR.  I can just run the WAR directly, like this:
java -jar mywebapp-server/target/mywebapp.war

And I can tell Google App Engine to do the same in the app.yaml:
entrypoint: java -jar mywebapp.war

And woohoo!  GWT running in Google App Engine:  https://gae-gwt-412604.appspot.com/
Reply all
Reply to author
Forward
0 new messages