maven gwt

273 views
Skip to first unread message

tong123123

unread,
May 15, 2012, 3:33:18 AM5/15/12
to google-we...@googlegroups.com
I do not know where to ask about maven gwt
I follow the link
http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html
and run
mvn archetype:generate \ -DarchetypeRepository=repo1.maven.org \ -DarchetypeGroupId=org.codehaus.mojo \ -DarchetypeArtifactId=gwt-maven-plugin \ -DarchetypeVersion=2.4.0

it prompt for groupId, artifactId, version, packaging and MODULES, but the MODULES only prompt once and
after enter all therse information, I open the pom.xml and cannot
found the section
<modules>

why?

the pom.xml is attached.
pom.xml

Thomas Broyer

unread,
May 15, 2012, 7:45:53 AM5/15/12
to google-we...@googlegroups.com


On Tuesday, May 15, 2012 9:33:18 AM UTC+2, tong123123 wrote:
I do not know where to ask about maven gwt

For the gwt-maven-plugin, you can ask in the dedicated forum: https://groups.google.com/d/forum/codehaus-mojo-gwt-maven-plugin-users
 
I follow the link
http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html
and run
mvn archetype:generate \ -DarchetypeRepository=repo1.maven.org \ -DarchetypeGroupId=org.codehaus.mojo \ -DarchetypeArtifactId=gwt-maven-plugin \ -DarchetypeVersion=2.4.0

it prompt for groupId, artifactId, version, packaging and MODULES, but the MODULES only prompt once and
after enter all therse information, I open the pom.xml and cannot
found the section
<modules>

why?

It asks for "module" (singular!), i.e. the GWT module name to generate. The value won't appear in the POM, but will be the name of several files: the *.launch files sibling to the pom.xml, the *.gwt.xml file in src/main/resources/${package}, the *.java file in src/main/java/${package}/client, and the *.html and *.css files in src/main/webapp. It will also appear in the src/main/webapp/WEB-INF/web.xml file.

If I were you, I'd rather use the webAppCreator tool from the GWT distribution (it unfortunately means you'd download the GWT SDK only for that tool, as you'll then download the artifacts from Maven): https://developers.google.com/web-toolkit/doc/latest/RefCommandLineTools#webAppCreator (the documentation unfortunately doesn't mention it can create a Maven project).

See also http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven (which discourages the use of the gwt-maven-plugin archetype).

When you're more comfortable with GWT and Maven (or if you're already comfortable with developing multi-module webapps with Maven), then you can try those archetypes: https://github.com/tbroyer/gwt-maven-archetypes

tong123123

unread,
May 15, 2012, 9:32:54 AM5/15/12
to google-we...@googlegroups.com
Great thanks for your reply.

In fact, I am very new to maven, there is many thing I still do not understand.
1) is GWT Maven Plugin = M2Eclipse + Google Eclipse plugins?
I use eclipse install new software and get the M2Eclipse from following site:
http://download.eclipse.org/technology/m2e/releases
and my eclipse already installed "Google Plugin for Eclipse", is this means I already have GWT Maven Plugin?

2) as stated in http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html
there should be ""Goals to run on project import" in eclipse windows > preferences > maven
but my eclipse has no this option!!
also, what is the setting for? I see the site remind to add "process-resources" before import project

3) when I choose
New project > maven > maven project >
use default workspace location >
catalog choose Nexus Indexer
error!!
No archetypes currently available. The archetype list will refresh when the indexes finish updating.
why this error will occur?

4) when restart eclipse, the status bar (bottom bar) always show
"Updating index centralhttp//repo1.maven.org/maven2: fetching http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.gz"
and it take a long time.
what is it doing?

thanks again

Thomas Broyer

unread,
May 15, 2012, 11:02:54 AM5/15/12
to google-we...@googlegroups.com


On Tuesday, May 15, 2012 3:32:54 PM UTC+2, tong123123 wrote:
Great thanks for your reply.

In fact, I am very new to maven, there is many thing I still do not understand.
1) is GWT Maven Plugin = M2Eclipse + Google Eclipse plugins?

No. gwt-maven-plugin is a Maven plugin that allows you to easily launch the GWT Compiler or DevMode (and several other tools: I18NSync, etc.) from Maven (configured in your POM). You could do all of that using the maven-antrun-plugin or exec-maven-plugin; gwt-maven-plugin just makes it "more Mavenish".

M2Eclipse is an Eclipse plugin to integrate Eclipse with Maven (automatically configure Eclipse projects from Maven POMs, for instance) and the Google Plugin for Eclipse integrates with both of them (when M2Eclipse is present) to automatically configure your Eclipse project with the GWT nature if it finds the gwt-maven-plugin and gwt-user dependency in your POM (so you can use "Run as… Web Application" from within Eclipse, for instance, and benefit from the GWT-RPC interface validation, and several other GWT-specific Eclipse features.
 
I use eclipse install new software and get the M2Eclipse from following site:
http://download.eclipse.org/technology/m2e/releases
and my eclipse already installed "Google Plugin for Eclipse", is this means I already have GWT Maven Plugin?

No.
But as with everything with Maven, it'll just be downloaded the first time Maven needs it (when building your project).

2) as stated in http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html
there should be ""Goals to run on project import" in eclipse windows > preferences > maven
but my eclipse has no this option!!
also, what is the setting for? I see the site remind to add "process-resources" before import project

You shouldn't have anything special to configure in Eclipse. The default configuration should be OK.
(it looks like this configuration has been removed from M2Eclipse)
 
3) when I choose
New project > maven > maven project >
use default workspace location >
catalog choose Nexus Indexer
error!!
No archetypes currently available. The archetype list will refresh when the indexes finish updating.
why this error will occur?

Sorry, no idea (well, see below). Ask on the M2Eclipse mailing list, or on StackOverflow.
 
4) when restart eclipse, the status bar (bottom bar) always show
"Updating index centralhttp//repo1.maven.org/maven2: fetching http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.gz"
and it take a long time.
what is it doing?

AFAIK, it downloads the "index" (listing which artifacts are available, in which versions, for fast searches on your machine, without the need to reach the network) from Maven Central (the place where most maven artifacts –including GWT ones– are deployed; which explains why the index is big, and thus takes time to download).

tong123123

unread,
May 15, 2012, 12:31:49 PM5/15/12
to google-we...@googlegroups.com
Thanks for reply.

As I am new to maven, what I first need to understand is the sample project
Mobile Web app sample
DynaTable RequestFactory sample
?

my current non-maven gwt application is web application (not mobile application), using gwt-rpc (not requestFactory).
is the above 2 sample project relevant to me?
there is no step by step guide for migrate a non-maven gwt application to maven gwt application?

Sorry as I need to migrate a non-maven gwt application to maven gwt application in a very short period, I have no any idea now.

Kei Kei

unread,
May 16, 2012, 2:40:40 AM5/16/12
to google-we...@googlegroups.com
following the website
http://www.uptick.com.au/content/getting-started-gwt-maven-and-eclipse#comment-263

and start from the middle
webAppCreator -maven -out MyGwtMavenSampleApp au.com.uptick.gwt.maven.sample.MyGwtMavenSampleApp

and finally the step

4. Test the application in development mode

At this point, you should be able to compile and run the new project in GWT Development Mode. Right-click on the pom.xml in the Project Explorer and choose "Run As -> Maven Build..." and run the "gwt:run" goal:

I can run the sample from webAppCreator in development mode, what should I do now to help me understand to transfer my origin non maven gwt application to maven gwt application?



Stefan Ollinger

unread,
May 16, 2012, 8:10:06 AM5/16/12
to google-we...@googlegroups.com
Hi,

in order to convert your project to maven, you need to apply the Maven folder structure:

src/main/java -> java sources
src/main/resources -> resources: .properties files, .xml files, ...
src/test/java -> test java sources
src/test/resources -> test resources

Then you need to create your own pom.xml. The pom.xml tells Maven about your project: what dependencies (jars) it has, the name of the project, the authors and then also how to build the project.

Take a look at that pom:

http://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/dynatablerf/pom.xml

You need to adjust the properties to your own settings. Most importantly are the project information in the header and the properties of the gwt-maven-plugin. If you dont use RequestFactory you can remove the build plugins maven-processor-plugin and build-helper-maven-plugin and some dependencies.

The other option you have, is to use a Maven archetype, which is a project template. Using an archetype creates a new project. So you would need to copy/paste your existing files over.

Regards,
Stefan
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/DVkLEcqw1gMJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Kei Kei

unread,
May 16, 2012, 9:18:41 AM5/16/12
to google-we...@googlegroups.com
I am in home now, but before using maven, I put the css file under module folder/public and I placed images folder under war directory, now I need place these css and image under "src/main/resources"?
In gwt developer guide
https://developers.google.com/web-toolkit/doc/latest/DevGuideOrganizingProjects
there is some suggested folder structure, if using maven, then should use maven structure and neglect the developer guide recommended structure, is it?


Stefan Ollinger

unread,
May 16, 2012, 12:01:38 PM5/16/12
to google-we...@googlegroups.com
The resources which are in your/module/package/public can still be
placed in src/main/java. Also if you have images which are used in
CssResource or UiBinder, they can be kept in src/main/java. This is a
pragmatic solution. Maven suggests to put them in src/main/resources.
See:
http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

The resources which go straight to the war/ folder should be placed
into: src/main/webapp.
See http://maven.apache.org/plugins/maven-war-plugin/ for more information.
> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.

Kei Kei

unread,
May 16, 2012, 12:15:38 PM5/16/12
to google-we...@googlegroups.com
 <!-- Mark the project for Google Plugin for Eclipse (GPE) -->
      <plugin>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.8</version>
        <configuration>
          <downloadSources>true</downloadSources>
          <downloadJavadocs>false</downloadJavadocs>
          <wtpversion>2.0</wtpversion>
          <additionalBuildcommands>
            <buildCommand>
              <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
            </buildCommand>
          </additionalBuildcommands>
          <additionalProjectnatures>
            <projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
          </additionalProjectnatures>
        </configuration>
      </plugin>
    </plugins>

I see the above plugin in http://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/dynatablerf/pom.xml
what is its use? I have not installed GPE, instead I have installed M2Eclipse. is GPE necessary?

Stefan Ollinger

unread,
May 16, 2012, 12:27:35 PM5/16/12
to google-we...@googlegroups.com
It adds the GWT project nature and the GWT builder to the eclipse project. You dont need the GPE, but i'd suggest you to use it. GPE adds syntax highlighting and completion to .ui.xml files, a development mode view and lots of other helpful things.

Kei Kei

unread,
May 16, 2012, 11:03:52 PM5/16/12
to google-we...@googlegroups.com
I use the webAppCreator -maven to generate a sample maven project and import to eclipse, I have installed m2eclipse and GPE, but when I right click the project and select run as web application, the web page show

HTTP ERROR: 404

NOT_FOUND

RequestURI=/MyGwtMavenSampleApp.html

Powered by Jetty://


what is the problem?
but I can run the sample if choose maven:build, and goal=gwt:run

Also, I subscribe https://groups.google.com/forum/#!forum/codehaus-mojo-gwt-maven-plugin-users
mailing list but the membership is always pending, what is the reason? how long it normally pending?

problemmaven1.jpg

Kei Kei

unread,
May 17, 2012, 1:50:33 AM5/17/12
to google-we...@googlegroups.com
in http://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/dynatablerf/pom.xml

 <configuration>
          <!-- URL that should be automatically opened in the GWT shell (gwt:run). -->
          <runTarget>DynaTableRf.html</runTarget>
          <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
          <compileReport>true</compileReport>
          <module>com.google.gwt.sample.dynatablerf.DynaTableRf</module>
          <logLevel>INFO</logLevel>
          <style>${gwt.style}</style>

          <copyWebapp>true</copyWebapp>
        </configuration>

why the pom.xml has no need to state the goal for run, compile but just insert parameter?
http://mojo.codehaus.org/gwt-maven-plugin/run-mojo.html

Also, if I don't want to use the gwt shell, but use normal IE, need change in this segment?
in fact, I am not familiar with the configuration segment, any good reference (it mention gwt-maven-plugin but I cannot found how it is used)

Kei Kei

unread,
May 17, 2012, 4:27:27 AM5/17/12
to google-we...@googlegroups.com
1)when deploy the maven gwt war and run in IE, nothing can be shown and there is js error as in attached output1.jpg, the project layout is attached as projectLayout.jpg, the pom.xml, console output when running maven:install is also attached.

2) and in the console, there is some warning about "WEB-INF"/web.xml which will be ignored...what is it?

3) the output structure is
target > AlsAdminViewerWebApp-1.0-SNAPSHOT>ALSADMINVIEWERWEBAPP>ALSADMINVIEWWEBAPP.NOCACHE.JS
the AlsAdminViewerWebApp.html is under target > AlsAdminViewerWebApp-1.0-SNAPSHOT
so in AlsAdminViewerWebApp.html,
should be
<src="ALSADMINVIEWERWEBAPP/ALSADMINVIEWWEBAPP.NOCACHE.JS"> or
<src="AlsAdminViewerWebApp-1.0-SNAPSHOT/ALSADMINVIEWERWEBAPP/ALSADMINVIEWWEBAPP.NOCACHE.JS"?

thanks

packageWarningMsg.txt
output1.jpg
projectLayout.jpg
pom.xml
maveninstall_trace.txt
Reply all
Reply to author
Forward
0 new messages