8
votes

I'm trying to create a GWT project through WebAppCreator enabled Maven2.

Project creation steps:

  1. Create project with WebAppCreator (i'm using gwt-2.3.0) ->webAppCreator -noant -maven -XnoEclipse -out MyApp com.example.MyApp
  2. Import project as existing maven project in eclipse (helios)
  3. Enable "Project" -> "Properties" -> "Google" -> "Google web toolkit" -> "Use google web toolkit" checkbox
  4. Set in project properties "Google" -> "Web application" -> "This project has a WAR directory". Set WAR directory path "src/main/webapp" and uncheck "launch and deploy from this directory"
  5. Java build path is "MyApp/target/www/WEB-INF/classes"
  6. I did not change the settings in pom.xml
  7. Compile project using gwt eclipse plugin (2.3.0 version). It successfully compiled.
  8. Try to run project as Web Application. When i run application GWT plugin does not ask me about WAR folder. I did all this, I saw in the logs:
[WARN] Server class 'com.example.server.GreetingServiceImpl' could not be found in the web app, but was found on the system classpath
   
[WARN] Adding classpath entry 'file:/home/redfox/workspace/java/redfox/MyApp/target/www/WEB-INF/classes/' to the web app classpath for this session

[WARN] Server class 'com.google.gwt.user.client.rpc.RemoteService' could not be found in the web app, but was found on the system classpath
   
[WARN] Adding classpath entry 'file:/home/redfox/.m2/repository/com/google/gwt/gwt-servlet/2.3.0/gwt-servlet-2.3.0.jar' to the web app classpath for this session

And when i try to load page from URL (http://127.0.0.1:8888/MyApp.html?gwt.codesvr=127.0.0.1:9997) i see 404 error. In logs i don't see any errors. How can i run this default application? Also i have another question: if this problev will be solved, how can i run this application in web mode (not in development mode) for using links like "http://127.0.0.1:8888" whithout param gwt.codesvr?

P.S. Sorry for my bad English.

4
I am having the same issues. Have been digging into it for hours. Clearly it is some kind of classloading issue in the maven get plugin.Kees de Kooter
i had problems like that too...caarlos0

4 Answers

0
votes

I understand your frustration, trust me, I recently went through exactly the same issue you having now.

As Eugene indicated, follow his instructions, but...

On the Select an Archetype choose version 2.3.0-1 (Others may work but this one works for me)

Select an Archetype

Generate your sample app using theat Archtype version. Do a mvn gwt:run, you will see this screen (If all goes well) Click on "Launch Default Browser".

Good luck. Cheers PB

Launcher

0
votes

I know this question is two years old. But i just had the same issue and now figured out how to fix it.

When eclipse doesn't ask you at the first launch for your "WAR" directory, you can also set it manually:

In eclipse go to "Run" -> "Debug Configuration...". Select your "Web Application" -> Select the "Arguments"-Tab and add the parameter e.g. "-war C:\YourProjectPath\target\YourProject-1.0-SNAPSHOT". Provide the full path here pointing to your target, generated by maven.

Hope that helps someone solving this issue faster :)

0
votes

I know this is old, but here is my latest approach (as also answered here)

I can't speak for the webAppCreator because I haven't used it, but I have had good luck creating the Maven projects in Eclipse using the gwt-maven-plugin from codehause.

Creating a Maven GWT Project Directy in Eclipse

  1. Open the new project wizard in Eclipse and filter on Maven Project.

  2. Select the Maven Project and click next.

  3. Enter the project location of your preference and click next.

  4. Enter "gwt-" into the archetype filter and select the gwt-maven-plugin from codehaus. Click Next.

  5. Enter your maven project details and a module value, then click Finish.

This will create a maven - gwt project for you in Eclipse. This comes with a sample application that you can use to make sure you can launch the application correctly.

Running the Application Command Line

  1. Open command line.
  2. Navigate to your project home.
  3. Run the command "mvn clean package".
  4. Run the command "mvn gwt:run"

This should get you up and running. If you used the 2.7.0 gwt-maven-plugin this should run the application in super dev mode by default.

Run the application in Eclipse

  1. As you have done, navigate to Properties > Google > Web Application and check "This project has a WAR directory". The WAR directory using this plugin should be src/main/webapp.
  2. Navigate to Properties > Google > Web Toolkit and check "This project has a WAR directory. You may be able to specify the module here. I am actually unable to do so, it may be specific to my Google Plugin for Eclipse or something environment specific...
  3. Run As > Web Application.
  4. If you had issues, as I have had, in step 2 then you will get an error Missing required argument 'module[s]'. To fix this open up your run configuration (should have been auto created) and in the arguments tab add the package qualified name for your module at the end of the arguments, e.g. com.mycompany.abc.GwtSampleModule. Do not add the ".gwt.xml" prefix.
    1. It's worth also checking that the HTML page referenced in your arguments is correct, I have also had issues with that.

The application should now be configured for Launch in Eclipse using this run configuration. My verified environment is:

  • Eclipse Luna (v4.4)
  • Google Plugin for Eclipse (v3.8)
  • GWT Maven Plugin (v2.7.0)
-2
votes

What I suggest may start slightly different than you prefer but with better results :)

  1. Install m2eclipse plugin. This will add a lot of nice maven features to your environment.
  2. Using new project wizard create new Maven project
  3. Do not select "simple project" check box, instead use the one of GWT archetypes (I suggest gwt-maven-plugin)

enter image description here

Then appropriate project structure with all required dependencies will be created for you by maven. More info about GWT plugin can be found at http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html, including on how to execute it.

P.S. Your English is fine :)