How do I run a maven/eclipse/GWT/playN app in prod

2019-05-27 17:25发布

问题:

There seems to be an issue if you want to launch a playN/GWT/maven app from eclipse in production mode using the following procedure:

  1. Right click on playn-showcase-html and select Goolge-GWT Compile

    Compiling module playn.showcase.Showcase Resolving com.google.gwt.validation.client.constraints.AbstractDecimalMaxValidator Found type 'com.google.gwt.validation.client.constraints.AbstractDecimalMaxValidator' Found type 'javax.validation.constraints.DecimalMax' [WARN] Detected warnings related to 'javax.validation.Constraint'. Is validation-<version>.jar on the classpath? Specify -logLevel DEBUG to see all errors. [WARN] Ignoring unresolvable annotation type javax.validation.Constraint Compiling 1 permutation Compiling permutation 0... Compile of permutations succeeded Linking into /Users/bryan/dev/playn-samples/showcase/html/target/playn-showcase-html-1.0-SNAPSHOT/showcase Link succeeded Compilation succeeded -- 19.459s

    Anyone know what these warnings are about?

  2. Right click on playn-showcase-html and select Run As web application

  3. Go to URL http://127.0.0.1:8888/Showcase.html in your browser and you'll get an error that says GWT module 'showcase' may need to be (re)compiled.

The only way around this appears to be if you swap steps 1 & 2, but that just seems backwards. I think the problem is that the when you run the web app from eclipse that the gwt maven plugin is compiling/deploying the artifacts again which step on your previous GWT compile step.

Anyways, this isn't a huge deal since you can reverse the order of steps to get it to work, but I was just curious if anyone has found a solution to this.

回答1:

I suggest that you try to compile/run it with maven directly, not through Eclipse, first go to the root directory of your game and do the following:

mvn clean package

that should compile your game without problems, and then

mvn test -Ptest-html

and that should run your game in http://localhost:8080/

Hope this helps, and I strongly suggest that use maven directly whenever you can, because Eclipse has a lot of incompatibility problems with some things.