Difference between revisions of "Create a new Mavenized gCube GWT Portlet Guide"

From Gcube Wiki
Jump to: navigation, search
(Project creation)
Line 32: Line 32:
 
== Project creation ==
 
== Project creation ==
  
Create a new maven project, when prompted for selecting the archetype type 'org.codehaus.mojo' and select the gwt-maven-plugin as shown in the picture below:
+
Create a new maven project, when prompted for selecting the archetype type 'org.codehaus.mojo' and select the gwt-maven-plugin as shown in the picture below (select 2.4.0 is you use GWT 2.4) :
  
 
[[File:Archetype.png]]
 
[[File:Archetype.png]]
Line 55: Line 55:
  
 
[[File:Emoty.png]]
 
[[File:Emoty.png]]
 +
 +
== Project first run ==
 +
 +
Now if you try to Run your project as a web application you will notice that also the web.xml is not complete, add what is suggested by the console n web.xml and everything should work fine, click the button and make sure the servlet communication works:
 +
 +
[[File:Fine.png]]

Revision as of 23:34, 23 December 2012

Preface

This guide is mostly about how to make the Google Eclipse Plugin, Eclipse and Maven work together. Which could not be trivial.

This guide was tested with Eclipse 3.7 Indigo EE, on MacOS 10.6.8 with Java 6. (only 3.7+ is supported)

The Google official Notes on working with GWT, Maven, and Google Plugin for Eclipse are available at this link. Use it for Troubleshooting and to get an overview of what you're going to do.

What you need

Maven Plugin for Eclipse (m2e)

Install the following plugin on your Eclipse:

I am using the latest stable releases from eclipse.org although the current WTP integration is still in incubation… but works.

Talking numbers, these are the version numbers I used:

  • m2e – Maven Integration for Eclipse 1.2.0.20120903-1050
  • m2e-wtp – Maven Integration for WTP (Incubation) 0.16.0.20120914-0945
  • m2e connector for mavenarchiver pom properties 0.15.0.201207090125-signed-201209140800

Google Plugin for Eclipse (GPE)

Google Plugin for Eclipse (GPE) makes it easy to import Maven projects using GWT and App Engine. To get started, first install GPE and the additional Eclipse plugins required for your version of Eclipse (remember that only Indigo+ is supported)


Project creation

Create a new maven project, when prompted for selecting the archetype type 'org.codehaus.mojo' and select the gwt-maven-plugin as shown in the picture below (select 2.4.0 is you use GWT 2.4) :

Archetype.png

Click next and enter the maven coordinates for your artifact, see below for an example:

Coordinate.png

Hit finish and the gwt-maven-plugin will create a sample gwt project for you. If you use Indigo at a certain point it will fail creating the goal i18n and the goal generateAsync, this should not happen with Eclipse Juno. Don't worry, you don't need Juno just do the following:

  • open your pom.xml, locate the GWT Maven Plugin <plugin> node and delete the goals generating errors (generateAsync, i18n) see picture below:

Goals.png

  • Open the GreetingService interface and generate its related ServiceAsync:

Async.png

  • Open your entrypoint class and make it compile by :
    • deleting this line: private final Messages messages = GWT.create(Messages.class);
    • inserting explicit stings in the sendButton constructor and setText methos as shown below:

Emoty.png

Project first run

Now if you try to Run your project as a web application you will notice that also the web.xml is not complete, add what is suggested by the console n web.xml and everything should work fine, click the button and make sure the servlet communication works:

Fine.png