1. Introduction to Apache
Maven 3 and GWT 2.5-rc2
Juan Manuel Rojas R.
http://rhemsolutions.com/ Lima, Perú 12/10/2012
2. Maven
Is a build automation tool typically used for
Java projects.
Maven dynamically downloads Java libraries
and Maven plug-ins from one or more
repositories such as the Maven 2 Central
Repository search.maven.org
Maven use an XML file to describe the
software project being built, dependencies,
plugins, etc.
Plugins
mvn [plugin-name]:[goal-name]
4. Installing the JDK
Windows
Download the JDK installer for Windows from http://www.oracle.
com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.html
Run the installer
Add the bin directory of the installed JDK to the PATH environment variable, as
described here: http://www.java.com/en/download/help/path.xml
To verify the JDK installation, open the Command Prompt and type
java -version.
5.
6.
7. Install Apache Maven 3
1. Download http://maven.apache.
org/download.html
2. Unzip
3. Add bin directory to system path
4. In command line write
mvn --version
8. The Maven Integration for Eclipse
(m2eclipse, Eclipse m2e)
Update Site
http://download.eclipse.org/technology/m2e/releases
Open eclipse
Help - Install New Software
Add
Name : m2e
Location: http://download.eclipse.org/technology/m2e/releases
Select all and Next
9. Using the Archetype
mvn archetype:generate -
DarchetypeGroupId=org.codehaus.mojo -
DarchetypeArtifactId=gwt-maven-plugin -
DarchetypeVersion=2.5.0-rc2
18. Setting the locale
Add to GWT module
<extend-property name="locale" values="es_PE"/>
(after entry point)
In HTML file Header (src/main/webapp/FirstProject.html)
<meta name="gwt:property" content="locale=es_PE">
Rename
Messages_fr.properties to Messages_es_PE.properties
19. GWT task
mvn gwt:i18n
Generate Messages.java interfaz from
Messages.properties and Messages_es_PE.
properties
mvn gwt:run
Run Dev Mode. Firefox is recommended and
install the GWT Developer Plugin (don't update
your browser) GWT DevMode Plugin for Firefox 16
Optional parameter
mvn gwt:run -Dgwt.codeServerPort=9997
22. Super dev mode
New in GWT 2.5. works in any browser, plugins
is not required.
Add to gwt module
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
remove or comment the last line in production
23. Super dev mode (Continuation)
Compile the application for first time
mvn package
Start the code server
mvn gwt:run-codeserver
or
mvn gwt:run-codeserver -Dgwt.codeServerPort=9876
The code server is ready.
Next, visit: http://localhost:9876/
24. Super dev mode (Continuation)
Add to bookmarks (Drag and Drop)
I am using Chrome
25. Super dev mode (Continuation)
Start the web server (without stop the server
code)
mvn gwt:run
We use jetty. e.g. Chrome
http://127.0.0.1:8888/FirstProject.html
without
?gwt.codesvr=127.0.0.1:9997(hosted mode)
26. Super dev mode (Continuation)
Dev Mode On
click
Dev Mode Off to clear cache
27. Super dev mode (Continuation)
Play with some changes to client code and test
with Dev Mode On. Update the browser is no
longer required
28. Super dev mode (Continuation)
Chrome Developer tools you can see the code
generated
29. Super dev mode (Continuation)
For see java code
Enable source maps in settings
30. Super dev mode (Continuation)
Recompile super dev mode with source maps
enabled.Click Dev Mode On