tbroyer / gwt-maven-archetypes

Apache License 2.0
152 stars 39 forks source link

modular-webapp artifact does not work with env-dev maven profile #46

Closed gardellajuanpablo closed 7 years ago

gardellajuanpablo commented 7 years ago

The app does not work if it is started as: mvn jetty:run -Penv-dev

It is required to update server pom.xml like that:

Generated by archetype:

<plugin>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <configuration>
    <webApp>
      <baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
        <resourcesAsCSV>src/main/webapp,${basedir}/../target/gwt/launcherDir/</resourcesAsCSV>
      </baseResource>
    </webApp>
  </configuration>
</plugin>

It should be

<plugin>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <configuration>
    <webApp>
      <baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
        <resourcesAsCSV>src/main/webapp,${basedir}/../${rootArtifactId}-client/target/productores-parent-client-${project.version}/,${basedir}/../target/gwt/launcherDir/</resourcesAsCSV>
      </baseResource>
    </webApp>
  </configuration>
</plugin>

Without adding client artifact, app.cache is not found.

Steps to reproduce: 1) Generate modular-webapp. 2) Import in eclipse (with GWT Eclipse plugin) 3) Starts CodeServer 4) Run jetty:run using profile env-dev

Also in order to work with super dev mode it is required to add <add-linker name="xsiframe" /> in the module.gwt.xml. I suggest to add the linker by default with the instructions indicating why this linker.

Thanks Tbroyer for this archetype.

tbroyer commented 7 years ago

The app.nocache.js (assuming that's what you mean by app.cache) is generated by the CodeServer in the launcherDir, which is configured in the root POM to ${project.build.directory}/gwt/launcherDir, and is correctly included in Jetty's resourcesAsCSV (as ${basedir}/../target/gwt/launcherDir/).

Did you run CodeServer using mvn gwt:codeserver? If not (e.g. using the GWT Eclipse Plugin), did you configure it the same? (i.e. to use target/gwt/launcherDir as -launcherDir).


Wrt <add-linker name="xsiframe"/>, this is the default linker since GWT 2.7; see https://github.com/tbroyer/gwt-maven-archetypes/commit/639b8d7a5864046af950b52d397402e86958b785

gardellajuanpablo commented 7 years ago

You are right. I didn't add -launcherDir argument in Eclipse launcher. Also it works without adding explicity the linker. Thanks a lot for your quick response.