You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UsingVaadinInAnExistingGWTProject.asciidoc 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. ---
  2. title: Using Vaadin In An Existing GWT Project
  3. order: 13
  4. layout: page
  5. ---
  6. [[using-vaadin-in-an-existing-gwt-project]]
  7. = Using Vaadin in an existing GWT project
  8. [[using-vaadin-jar-with-google-eclipse-plugin-in-a-gwt-project]]
  9. Using Vaadin JAR with Google Eclipse plugin in a GWT project
  10. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. With GWT development and run-time classes now included in Vaadin, it is
  12. easy to move from Google's build of GWT to Vaadin.
  13. By switching to the GWT integrated in Vaadin 7, you immediately get
  14. easier integration of SuperDevMode in your application. Many future GWT
  15. bugfixes will be available in Vaadin before they get integrated to the
  16. official version and more and more Vaadin widgets ready to use in your
  17. application. You risk nothing and can easily switch back to stand-alone
  18. GWT if you don't use features from `com.vaadin` packages.
  19. You also have the option to easily move to a hybrid application
  20. development model integrating business logic on the server with custom
  21. components and other parts of your UI implemented using GWT. You can
  22. easily combine the productivity and security benefits of a server side
  23. framework with the flexibility of client side development where needed.
  24. [[using-google-eclipse-plugin]]
  25. Using Google Eclipse Plugin
  26. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27. Google Plugin for Eclipse assumes the use of GWT SDK. Nevertheless, the
  28. plugin can easily be used to develop client side applications with
  29. Vaadin, by following the steps described below.
  30. For lighter deployment, a minimal run-time version of Vaadin JAR will be
  31. available in the future.
  32. 1. You need to have the IvyDE plugin for Eclipse installed
  33. 2. Disable some error messages by setting *Preferences... → Google →
  34. Errors/Warnings → Missing SDK → Ignore*. Note that you may still get an
  35. error message about missing `gwt-servlet.jar` when modifying project
  36. build path.
  37. 3. If you don't already have a client side application project, you can
  38. create one with "New Web Application Project...", selecting any recent
  39. version of the GWT SDK. If you don't have any version of GWT installed,
  40. download one
  41. https://code.google.com/p/google-web-toolkit/downloads/list[here] - the
  42. next steps will switch to using Vaadin JAR.
  43. 4. Open project properties, select *Java Build Path → Libraries* and
  44. remove the GWT SDK from the project class path
  45. 5. In the project properties, make sure the project JRE version in
  46. *Project Facets* is 1.6 or later
  47. 6. Copy the `ivy.xml` and `ivy-settings.xml` from an existing Vaadin
  48. project created with the Vaadin Plugin for Eclipse
  49. 7. Set the Vaadin version in `ivy.xml` to your preferred version
  50. 8. Add the following dependency in the `ivy.xml`:
  51. `<dependency org="javax.servlet" name="jsp-api" rev="2.0" />`
  52. 9. Right-click the `ivy.xml` and select *Add Ivy library...* and click
  53. *Finish*
  54. 10. Right-click project, select *Ivy → Resolve*
  55. That's it - you are now ready to debug the application using GWT
  56. development mode server:
  57. * *Debug as... → Web Application*
  58. To avoid the need to install and update browser plug-ins, use SuperDevMode.
  59. [[using-maven]]
  60. Using Maven
  61. ~~~~~~~~~~~
  62. Also the Maven plug-in for GWT makes some assumptions but it is easy to
  63. switch to the combined Vaadin JAR.
  64. As the Vaadin JAR now includes GWT, Maven projects should not depend
  65. directly on GWT JARs (gwt-user, gwt-dev, gwt-servlet).
  66. To convert an existing Maven project, perform the following
  67. modifications in your pom.xml
  68. * update compiler source and target Java version to 1.6
  69. * remove dependencies to GWT (`com.google.gwt:gwt-user`,
  70. `com.google.gwt:gwt-servlet`, `com.google.gwt:gwt-dev`)
  71. * add dependencies to
  72. Vaadin
  73. [source,xml]
  74. ....
  75. <!-- this replaces gwt-user.jar -->
  76. <dependency>
  77. <groupId>com.vaadin</groupId>
  78. <artifactId>vaadin-client</artifactId>
  79. <version>7.0.0.beta9</version>
  80. <scope>provided</scope>
  81. </dependency>
  82. <!-- this replaces gwt-dev.jar -->
  83. <dependency>
  84. <groupId>com.vaadin</groupId>
  85. <artifactId>vaadin-client-compiler</artifactId>
  86. <version>7.0.0.beta9</version>
  87. <scope>provided</scope>
  88. </dependency>
  89. <!-- optional - this replaces gwt-servlet.jar etc. and is deployed on the server -->
  90. <dependency>
  91. <groupId>com.vaadin</groupId>
  92. <artifactId>vaadin-server</artifactId>
  93. <version>7.0.0.beta9</version>
  94. </dependency>
  95. ....
  96. * if not included e.g. via Jetty/Tomcat/other, add a "provided"
  97. dependency to the servlet
  98. API
  99. [source,xml]
  100. ....
  101. <dependency>
  102. <groupId>javax.servlet</groupId>
  103. <artifactId>servlet-api</artifactId>
  104. <version>2.5</version>
  105. <scope>provided</scope>
  106. </dependency>
  107. ....
  108. * replace the `gwt-maven-plugin` with `com.vaadin:vaadin-maven-plugin`,
  109. comment out `<dependencies>` in its configuration (if exists) and use
  110. plug-in version that matches the Vaadin version
  111. * use goal `vaadin:compile` instead of `gwt:compile` etc.
  112. The vaadin-client, vaadin-client-compiler and their dependencies only
  113. need to be deployed on the server for debugging with
  114. SuperDevMode.