Geoffrey De Smet
Geoffrey De Smet

Reputation: 27337

How do I set up GWT Super Dev Mode with the new (tbroyer) maven-gwt-plugin on WildFly?

With the new maven-gwt-plugin (which officially replaces the legacy mojo one), I can run GWT Super Dev Mode as such:

mvn gwt:codeserver

How I do get my backend to run with WildFly (it uses JAX-RS and other JavaEE technologies)?

Upvotes: 2

Views: 782

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27337

Use EmbeddedWildFlyLauncher

  • Add the errai-cdi-jboss dependency which includes a launcher for WildFly
  • but also exclude the apache-jsp dependency from gwt-dev to avoid an error.

The parent pom.xml looks like this:

<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-dev</artifactId>
  <exclusions>
    <exclusion>
      <!-- Contains a ServletContainerInitializer that breaks the EmbeddedWildFlyLauncher during GWT Super Dev Mode -->
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>apache-jsp</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <!-- Only used for EmbeddedWildFlyLauncher during GWT Super Dev Mode -->
  <groupId>org.jboss.errai</groupId>
  <artifactId>errai-cdi-jboss</artifactId>
  <scope>runtime</scope>
</dependency>
  • configure the WildFly launcher EmbeddedWildFlyLauncher from errai-cdi-jboss in the maven-gwt-plugin
  • Configure the errai.jboss.home system property for the spawned process, so the launcher can start up WildFly.
  • Configure the warDir to the exploded directory, so that the backend war is also loaded (so your REST/RPC calls coming from the GWT client actually have someone answering them on the backend).

That section in the parent pom.xml looks like this:

    <plugin>
      <groupId>net.ltgt.gwt.maven</groupId>
      <artifactId>gwt-maven-plugin</artifactId>
      <extensions>true</extensions>
      <configuration>
        <devmodeArgs>
          <!-- GWT Super Dev Mode: Replace default backend by WildFly -->
          <arg>-server</arg>
          <arg>org.jboss.errai.cdi.server.gwt.EmbeddedWildFlyLauncher</arg>
          <arg>-startupUrl</arg>
          <arg>gwtui/gwtui.html</arg>
        </devmodeArgs>
        <!-- GWT Super Dev Mode: deploy backend correctly -->
        <warDir>optashift-employee-rostering-webapp/target/optashift-employee-rostering-webapp-${project.version}</warDir>
        <systemProperties>
          <!-- GWT Super Dev Mode: which WildFly to use -->
          <errai.jboss.home>${wildfly.home}</errai.jboss.home>
        </systemProperties>
      </configuration>
    </plugin>

then run

mvn gwt:devmode

IMPORTANT: this doesn't work entirely because the backend isn't the actual wildfly war but only the gwt ui war...

Upvotes: 1

Related Questions