Introduction maven3 and gwt2.5 rc2 - Lesson 01

8,305 views

Published on

First Part of GWT Course

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
8,305
On SlideShare
0
From Embeds
0
Number of Embeds
6,666
Actions
Shares
0
Downloads
35
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Introduction maven3 and gwt2.5 rc2 - Lesson 01

  1. 1. Introduction to Apache Maven 3 and GWT 2.5-rc2Juan Manuel Rojas R.http://rhemsolutions.com/ Lima, Perú 12/10/2012
  2. 2. MavenIs a build automation tool typically used forJava projects.Maven dynamically downloads Java librariesand Maven plug-ins from one or morerepositories such as the Maven 2 CentralRepository search.maven.orgMaven use an XML file to describe thesoftware project being built, dependencies,plugins, etc.Pluginsmvn [plugin-name]:[goal-name]
  3. 3. POM.xml(Project Object Model)
  4. 4. Installing the JDKWindowsDownload the JDK installer for Windows from http://www.oracle.com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.htmlRun the installerAdd the bin directory of the installed JDK to the PATH environment variable, asdescribed here: http://www.java.com/en/download/help/path.xmlTo verify the JDK installation, open the Command Prompt and typejava -version.
  5. 5. Install Apache Maven 31. Download http://maven.apache.org/download.html2. Unzip3. Add bin directory to system path4. In command line write mvn --version
  6. 6. The Maven Integration for Eclipse(m2eclipse, Eclipse m2e)Update Sitehttp://download.eclipse.org/technology/m2e/releasesOpen eclipseHelp - Install New SoftwareAddName : m2eLocation: http://download.eclipse.org/technology/m2e/releasesSelect all and Next
  7. 7. Using the Archetypemvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0-rc2
  8. 8. New Project
  9. 9. Run dev mode
  10. 10. Import in EclipseIf Eclipse ask to installa connector -> installthen restart eclipse
  11. 11. Add this lines<extraJvmArgs>-XX:MaxPermSize=512m -Xmx1024m</extraJvmArgs><generateDirectory>${project.build.sourceDirectory}</generateDirectory>
  12. 12. <compilerArgument>-proc:none</compilerArgument>required by JPA
  13. 13. Setting the localeAdd 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
  14. 14. GWT taskmvn gwt:i18nGenerate Messages.java interfaz fromMessages.properties and Messages_es_PE.propertiesmvn gwt:runRun Dev Mode. Firefox is recommended andinstall the GWT Developer Plugin (dont updateyour browser) GWT DevMode Plugin for Firefox 16Optional parametermvn gwt:run -Dgwt.codeServerPort=9997
  15. 15. GWT task (Continuation)mvn packageBuild the war file of the application in targetdirectory.
  16. 16. GWT dev mode
  17. 17. Super dev modeNew in GWT 2.5. works in any browser, pluginsis 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
  18. 18. Super dev mode (Continuation)Compile the application for first timemvn packageStart the code servermvn gwt:run-codeserverormvn gwt:run-codeserver -Dgwt.codeServerPort=9876The code server is ready.Next, visit: http://localhost:9876/
  19. 19. Super dev mode (Continuation)Add to bookmarks (Drag and Drop)I am using Chrome
  20. 20. Super dev mode (Continuation)Start the web server (without stop the servercode)mvn gwt:runWe use jetty. e.g. Chromehttp://127.0.0.1:8888/FirstProject.htmlwithout?gwt.codesvr=127.0.0.1:9997(hosted mode)
  21. 21. Super dev mode (Continuation)Dev Mode On clickDev Mode Off to clear cache
  22. 22. Super dev mode (Continuation)Play with some changes to client code and testwith Dev Mode On. Update the browser is nolonger required
  23. 23. Super dev mode (Continuation)Chrome Developer tools you can see the codegenerated
  24. 24. Super dev mode (Continuation)For see java codeEnable source maps in settings
  25. 25. Super dev mode (Continuation)Recompile super dev mode with source mapsenabled.Click Dev Mode On
  26. 26. Super dev mode (Continuation)
  27. 27. Referenceshttp://en.wikipedia.org/wiki/Apache_Mavenhttps://developers.google.com/web-toolkit/articles/superdevmodehttp://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

×