Thanks Tim!  Looking at your POM files, I see I missed adding:

<outputDirectory
>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/classes</
outputDirectory>

I also needed to:

   - Convert all my servlets to @WebServlet (as the GWT Jetty server didn't 
   pick up my web.xml like the GAE server used to).
   - Give the GWT plugin the JVM arg 
   "--add-opens java.base/java.lang=ALL-UNNAMED" for execeptions to be 
   returned to the client.

Strangely, Maven isn't copying my src/main/webapp files to the target 
folder, so I'm doing that manually with the maven-resources-plugin.

So now GWT starts, dev compiles (including source maps), and runs 
beautifully, including RPC calls.  Java17 runtime with a Java11 source 
level.  Happy days!  New POM attached.

I've switched from using Eclipse to IntelliJ (because I no longer will be 
using any of the Eclipse plugins, and wanted a fresh start).  However, 
debugging my server never hits the breakpoints.

Do you use IntelliJ, do we need any special params to enable debug?

[image: debug.png]

I'm yet to get Google App Engine to work.  When I try to access any of the 
GAE calls, I just get "No API environment is registered for this thread.".  
I think I need to setup the enviroment somehow now I no longer have a GAE 
server.

Cheers!

On Friday 22 December 2023 at 4:41:07 am UTC+11 [email protected] 
wrote:

> These are my current poms, based on the tbroyer archetype.
> Probably best to look at the latter first if youre not familiar with it.
>
> The launch is configured in the server pom:
>
>     <profile>
>       <id>env-dev-gae1</id>
>       <activation>
>         <property>  
>           <name>env</name>
>           <value>haslistener</value>
> ...
>       <build>                    
>         <pluginManagement>
>           ...
>
>               <groupId>com.google.cloud.tools</groupId>
>               <artifactId>appengine-maven-plugin</artifactId>
>
> A version of Jetty is attached by the appengine-maven-plugin config here 
> (afaik)
> The eclipse launch goal is: appengine:run -Denv=haslistener
>
> Re GWT 2.10 : it can use JRE 17 but can only compile Java 11 source, iirc.
>
> Poms are a bit messy but should help if you want to take this approach
>
> On Thursday, December 21, 2023 at 11:36:51 AM UTC Craig Mitchell wrote:
>
>> Forgot to mention.  My target is Java 17, but my source is Java 1.8.
>>
>> So:
>> <properties>
>> <maven.compiler.source>1.8</maven.compiler.source>
>> <maven.compiler.target>17</maven.compiler.target>
>> </properties>
>>
>> And:
>> <pluginManagement>
>> <plugins>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-compiler-plugin</artifactId>
>> <version>3.11.0</version>
>> <configuration>
>> <source>${maven.compiler.source}</source>
>> <target>${maven.compiler.target}</target>
>> </configuration>
>> </plugin>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-resources-plugin</artifactId>
>> <version>3.3.1</version>
>> </plugin>
>> </plugins>
>> </pluginManagement>
>>
>> I've attached my current POM (which isn't working, so don't copy it 🙂), 
>> but if you can see my mistake, please let me know.
>>
>> Thanks again!
>> On Thursday 21 December 2023 at 10:27:01 pm UTC+11 Craig Mitchell wrote:
>>
>>> Hi Tim,
>>>
>>> I thought GWT 2.10.0 supported Java17.  From the release notes:   
>>> https://www.gwtproject.org/release-notes.html#Release_Notes_2_10_0
>>> *Tested support for running on Java 17, dropped remaining support for 
>>> running on Java 7.*
>>>
>>> I'm also using appengine-maven-plugin 2.5.0.
>>> <plugin>
>>> <groupId>com.google.cloud.tools</groupId>
>>> <artifactId>appengine-maven-plugin</artifactId>
>>> <version>2.5.0</version>
>>> <configuration>
>>> <projectId>headtoheaddrifting</projectId>
>>> <version>GCLOUD_CONFIG</version>
>>> </configuration>
>>> </plugin>
>>>
>>> Along with GWT plugin:
>>> <plugin>
>>> <groupId>net.ltgt.gwt.maven</groupId>
>>> <artifactId>gwt-maven-plugin</artifactId>
>>> <version>1.1.0</version>
>>> <extensions>true</extensions>
>>> <configuration>
>>> <moduleName>team.drift.DriftTeam</moduleName>
>>> <moduleShortName>dt</moduleShortName>
>>> <packaging>gwt-lib</packaging>
>>> <launcherDir>${project.build.directory}/gwt/launcherDir</launcherDir>
>>> <warDir>${project.build.directory}/drift-team-1.0-SNAPSHOT</warDir>
>>> <startupUrls>
>>> <startupUrl>index.html</startupUrl>
>>> </startupUrls>
>>> </configuration>
>>> </plugin>
>>>
>>> Running: "mvn gwt:devmode" I can get it to start the Jetty server and 
>>> GWT code server.  It finds my project, but currently, when opening the 
>>> browser it says:
>>> HTTP ERROR 503 Service Unavailable
>>> URI: /index.html
>>> STATUS: 503
>>> MESSAGE: Service Unavailable
>>> SERVLET: -
>>>
>>> I put my web assets in  src/main/webapp  and I don't think it's seeing 
>>> them.  Plus I don't think it's seeing my web.xml that's in 
>>>  src/main/webapp/WEB-INF/web.xml
>>>
>>> Maybe they need to be copied to the target directory or somewhere, or 
>>> the GWT plugin pointed to where they are somehow.  Not sure.  Any help is 
>>> greatly appreaciated.
>>>
>>>
>>> On Thursday 21 December 2023 at 4:06:46 am UTC+11 [email protected] 
>>> wrote:
>>>
>>>> I havent tried raising the Java level yet, its still  JavaSE-1.8. 
>>>> Got as far as using latest versions:
>>>> JDK 21
>>>> gcloud CLI app & cloudSdkVersion  457.0.0 
>>>> appengine-maven-plugin 2.5.0
>>>>
>>>> To get it to run, so far:
>>>> 1 I had to remove all DOCTYPE declarations in xml files in the server 
>>>> project (new restrictions on DTD)
>>>> 2 appengine-maven-plugin 2.5.0 requires:
>>>>                 <configuration>
>>>>                     <jvmFlags>
>>>>                         <item>--add-opens</item>
>>>>                 <item>java.base/java.util=ALL-UNNAMED</item>
>>>> This stops 500 Server Error which I've not seen before:
>>>> GCLOUD: java.lang.reflect.InaccessibleObjectException:
>>>> Unable to make field accessible: module java.base does not "opens 
>>>> java.util" to unnamed module @2c95ac9e
>>>>
>>>> So Craig, you say with Java17 on GAE, there isn't a web server included 
>>>> anymore.
>>>> So this has to be defined somewhere in  appengine-maven-plugin ?
>>>> The minimum level to avoid being shut down on GAE standard is >8
>>>> & 11 is the max for GWT, so that would seem do for now, why Java 17  ?
>>>>
>>>> On Wednesday, December 20, 2023 at 4:46:03 AM UTC Craig Mitchell wrote:
>>>>
>>>>> No worries not posting the POMs Tim.
>>>>>
>>>>> The bit I'm struggling with, the old Java 8 version had its own GAE 
>>>>> server.  So I would run that, and a GWT Code Server.  Easy!
>>>>>
>>>>> *btw:* I'm talking about GAE Standard.  GAE Flexible you can do 
>>>>> whatever you want, but that's more work and more expensive.
>>>>>
>>>>> Now with the upgrade to Java17 on GAE, there isn't a web server 
>>>>> included anymore.  It's up to you to supply one.  I would assume when you 
>>>>> deploy it, it doesn't actually use your server, but what setup is GAE 
>>>>> expecting for the deploy?
>>>>>
>>>>> I see there is a SpringBoot GAE example, so it might be easier to use 
>>>>> that, and get GWT to work with SpringBoot.  Not sure.  Very interested to 
>>>>> hear what you're doing.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> On Wednesday 20 December 2023 at 1:51:55 pm UTC+11 
>>>>> [email protected] wrote:
>>>>>
>>>>>> For some years I've been deploying GWT 2.8.2 to GAE with Maven & 
>>>>>> Google Cloud Tools. 
>>>>>> I now find GAE is not supporting Java 8 after January, so currently 
>>>>>> upgrading (rather slowly). 
>>>>>> There are 4 long POM files,  probably better to mail them then post a 
>>>>>> distilled version here ?
>>>>>>
>>>>>> On Sunday, December 17, 2023 at 5:20:56 AM UTC Craig Mitchell wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> The instructions here 
>>>>>>> https://www.gwtproject.org/doc/latest/tutorial/appengine.html are 
>>>>>>> no longer valid, as the Google Plugin for Eclipse is now dead (Google 
>>>>>>> no 
>>>>>>> longer supports Java 1.8, and the Google Plugin for Eclipse doesn't 
>>>>>>> support 
>>>>>>> any Eclipse versions that support anything after Java 1.8).  Ref:  
>>>>>>> https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/3710
>>>>>>>
>>>>>>> The new approach with GAE is to use Maven or Gradle with Google 
>>>>>>> Cloud Tools.
>>>>>>>
>>>>>>> I've been struggling to work out how this is supposed to happen.  It 
>>>>>>> looks like we now have to provide our own Web Server for GAE, but can 
>>>>>>> we 
>>>>>>> use the Jetty server that GWT uses for development?  I assume the 
>>>>>>> deploy 
>>>>>>> build would not include the Jetty web server?
>>>>>>>
>>>>>>> If anyone has deployed a GWT app to GAE with Maven and the new 
>>>>>>> Google Cloud Tools, it would be great if you could give high level 
>>>>>>> instructions on how it's all supposed to fit together.
>>>>>>>
>>>>>>> An example Maven POM file with both the Google Cloud Tools, and GWT 
>>>>>>> would be even better.  🙂
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/2a306765-274d-48cb-ab3f-f95261bf6af3n%40googlegroups.com.
<project xmlns="http://maven.apache.org/POM/4.0.0";
		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
	<modelVersion>4.0.0</modelVersion>

	<groupId>team.drift</groupId>
	<artifactId>drift-team</artifactId>
	<version>1.0-SNAPSHOT</version>

	<properties>
		<maven.compiler.source>11</maven.compiler.source>
		<maven.compiler.target>17</maven.compiler.target>
		<maven.compiler.release>17</maven.compiler.release>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<!-- Defines what dependencies can be used -->
	<dependencyManagement>
		<dependencies>
			<!-- GWT -->
			<dependency>
				<groupId>org.gwtproject</groupId>
				<artifactId>gwt</artifactId>
				<version>2.10.0</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<!-- GWT and GAE-->
			<dependency>
				<groupId>javax.servlet</groupId>
				<artifactId>javax.servlet-api</artifactId>
				<version>3.1.0</version>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<!-- Actually uses these dependencies -->
	<dependencies>
		<!-- GWT -->
		<dependency>
			<groupId>org.gwtproject</groupId>
			<artifactId>gwt-user</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gwtproject</groupId>
			<artifactId>gwt-dev</artifactId>
		</dependency>
		<dependency>
			<groupId>org.gwtproject</groupId>
			<artifactId>gwt-servlet</artifactId>
		</dependency>

		<!-- GWT and GAE -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
		</dependency>

		<!-- GAE -->
		<dependency>
			<groupId>com.google.appengine</groupId>
			<artifactId>appengine-api-1.0-sdk</artifactId>
			<version>2.0.23</version>
		</dependency>

		<!-- JSON on the server https://mvnrepository.com/artifact/org.json/json -->
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20231013</version>
		</dependency>

		<!-- PayPal https://mvnrepository.com/artifact/com.paypal.sdk/checkout-sdk -->
		<dependency>
			<groupId>com.paypal.sdk</groupId>
			<artifactId>checkout-sdk</artifactId>
			<version>1.0.3</version>
		</dependency>

		<!-- PNG compressor https://mvnrepository.com/artifact/com.github.depsypher/pngtastic -->
		<dependency>
			<groupId>com.github.depsypher</groupId>
			<artifactId>pngtastic</artifactId>
			<version>1.6</version>
		</dependency>

		<!-- JUnit -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-api</artifactId>
			<version>5.10.1</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>

		<plugins>
			<!-- Google App Engine -->
			<plugin>
				<groupId>com.google.cloud.tools</groupId>
				<artifactId>appengine-maven-plugin</artifactId>
				<version>2.5.0</version>
				<configuration>
					<projectId>headtoheaddrifting</projectId>
					<version>GCLOUD_CONFIG</version>
				</configuration>
			</plugin>

			<!-- GWT -->
			<plugin>
				<groupId>net.ltgt.gwt.maven</groupId>
				<artifactId>gwt-maven-plugin</artifactId>
				<version>1.1.0</version>
				<configuration>
					<moduleName>team.drift.DriftTeam</moduleName>
					<moduleShortName>dt</moduleShortName>
					<launcherDir>${project.build.directory}/${project.artifactId}-${project.version}</launcherDir>
					<warDir>${project.build.directory}/${project.artifactId}-${project.version}</warDir>
					<startupUrls>
						<startupUrl>/</startupUrl>
					</startupUrls>
					<jvmArgs>
						<jvmArg>-Xmx2048M</jvmArg>
						<jvmArg>--add-opens</jvmArg>
						<jvmArg>java.base/java.lang=ALL-UNNAMED</jvmArg>
					</jvmArgs>
				</configuration>
			</plugin>

			<!-- TODO: Manually copy the src/main/webapp files. Maven should do this automatically, but it isn't? -->
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>3.3.1</version>
				<executions>
					<execution>
						<id>copy-resources</id>
						<phase>compile</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}</outputDirectory>
							<resources>
								<resource>
									<directory>src/main/webapp</directory>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>

Reply via email to