Introduction maven3 and gwt2.5 rc2 - Lesson 01
-
Upload
rhemsolutions -
Category
Documents
-
view
7.299 -
download
2
description
Transcript of Introduction maven3 and gwt2.5 rc2 - Lesson 01
Introduction to Apache Maven 3 and GWT 2.5-rc2
Lima, Perú 12/10/2012Juan Manuel Rojas R.http://rhemsolutions.com/
MavenIs 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.orgMaven use an XML file to describe the software project being built, dependencies, plugins, etc.Pluginsmvn [plugin-name]:[goal-name]
POM.xml(Project Object Model)
Installing the JDK
WindowsDownload 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.
Install Apache Maven 3
1. Download http://maven.apache.org/download.html2. Unzip3. Add bin directory to system path 4. In command line write mvn --version
The Maven Integration for Eclipse (m2eclipse, Eclipse m2e)
Update Sitehttp://download.eclipse.org/technology/m2e/releases
Open eclipseHelp - Install New SoftwareAdd Name : m2eLocation: http://download.eclipse.org/technology/m2e/releases
Select all and Next
Using the Archetype
mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0-rc2
New Project
Run dev mode
Import inEclipse
If Eclipse ask to install a connector -> installthen restart eclipse
Add this lines<extraJvmArgs>-XX:MaxPermSize=512m -Xmx1024m</extraJvmArgs><generateDirectory>${project.build.sourceDirectory}</generateDirectory>
<compilerArgument>-proc:none</compilerArgument>required by JPA
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">
RenameMessages_fr.properties to Messages_es_PE.properties
GWT taskmvn gwt:i18nGenerate Messages.java interfaz from Messages.properties and Messages_es_PE.properties
mvn gwt:runRun Dev Mode. Firefox is recommended and install the GWT Developer Plugin (don't update your browser) GWT DevMode Plugin for Firefox 16Optional parametermvn gwt:run -Dgwt.codeServerPort=9997
GWT task (Continuation)
mvn packageBuild the war file of the application in target directory.
GWT dev mode
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
Super dev mode (Continuation)
Compile the application for first timemvn package
Start the code servermvn gwt:run-codeserveror mvn gwt:run-codeserver -Dgwt.codeServerPort=9876The code server is ready.Next, visit: http://localhost:9876/
Super dev mode (Continuation)
Add to bookmarks (Drag and Drop)I am using Chrome
Super dev mode (Continuation)
Start the web server (without stop the server code)mvn gwt:run
We use jetty. e.g. Chromehttp://127.0.0.1:8888/FirstProject.htmlwithout?gwt.codesvr=127.0.0.1:9997(hosted mode)
Super dev mode (Continuation)
Dev Mode On
Dev Mode Off to clear cache
click
Super dev mode (Continuation)
Play with some changes to client code and test with Dev Mode On. Update the browser is no longer required
Super dev mode (Continuation)
Chrome Developer tools you can see the code generated
Super dev mode (Continuation)
For see java code
Enable source maps in settings
Super dev mode (Continuation)
Recompile super dev mode with source maps enabled.Click Dev Mode On
Super dev mode (Continuation)
Referenceshttp://en.wikipedia.org/wiki/Apache_Maven
https://developers.google.com/web-toolkit/articles/superdevmode
http://tbroyer.posterous.com/how-does-gwts-super-dev-mode-workhttp://stackoverflow.com/questions/11356714/getting-started-with-the-superdevmodehttp://www.youtube.com/watch?v=-xJl22Kvgjg