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.

CreatingAnEclipseProject.asciidoc 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. title: Creating An Eclipse Project
  3. order: 69
  4. layout: page
  5. ---
  6. [[creating-an-eclipse-project]]
  7. = Creating an Eclipse project
  8. At the moment you have two options:
  9. * Creating a Maven project in Eclipse
  10. * Using the Vaadin plug-in to create an Ivy project in Eclipse
  11. [[create-a-maven-project-in-eclipse]]
  12. Create a Maven project in Eclipse
  13. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. To create a Maven project in Eclipse you will need to have to Maven
  15. plugin installed. To install the plugin in Eclipse select "Help->Eclipse
  16. Marketplace" and search for "Maven Integration for Eclipse". If you do
  17. not have it installed install it before continuing. You will need to
  18. restart Eclipse after installation is complete. When Eclipse has
  19. restarted it will start the Maven repository indexer which will take a
  20. while to finish so wait patiently for it to finish before trying to
  21. create a new project, else the new project archetype will not be found.
  22. To create a new Vaadin maven project in Eclipse, start by selecting "File
  23. -> New -> Project..." and select "Maven Project". When clicking "Next"
  24. two times you will see a list of available archetypes. Write "vaadin" in
  25. the filter field and select "vaadin-archetype-application". This will
  26. create a Vaadin 7 application for you.
  27. Now you still need to enter some project info for your Maven project
  28. such as group id, artifact id and version. Once you are done, click
  29. "Finish". The project structure should now be ready.
  30. Next you will need to create a launch configuration for compiling the
  31. widget set. This can be done by right clicking on the project in the
  32. Project Explorer and select Run As.. -> Run Configurations... Then right
  33. click on Maven Build and select New. You will be presented by the
  34. following dialog:
  35. image:img/maven-compile-widgetset-launch.png[Run configuration: Compile Widgetset]
  36. Click run and the widget set will compile. You should do this whenever
  37. you add new addons or client side classes to the project.
  38. To run the project we will need to create a similar launch script. So,
  39. start by creating another Maven Build launch configuration just like we
  40. did above but instead of using the `vaadin:compile` target we will use the
  41. `jetty:run` target. Here is my ready made configuration for that:
  42. image:img/maven-run-project.png[Maven run configuration]
  43. Now, click Run and your project should be running on
  44. http://localhost:8080
  45. [[using-the-vaadin-plug-in-to-create-an-ivy-project-in-eclipse]]
  46. Using the Vaadin plug-in to create an Ivy project in Eclipse
  47. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  48. The Vaadin Plug-in is based on a Dynamic Web Project and therefore uses
  49. Ivy instead of Maven for handling the dependencies.
  50. So lets start by adding the update sites to our eclipse installation.
  51. This can be done by selecting "Help->Install New Software" in eclipse.
  52. In the dialog which opens we need to add the Vaadin update site.
  53. Click "Add..." and add the following and click OK.
  54. ....
  55. Name: Vaadin Eclipse Plugin
  56. Location: http://vaadin.com/eclipse
  57. ....
  58. Once that is done select the Vaadin plugin like have been done below.
  59. image:img/eclipse-plugin-install.png[Eclipse Vaadin plugin installation]
  60. Select "Next->Next->Finish" and the plugin will be installed. You will
  61. need to restart eclipse for the plugin to take effect.
  62. Once the plugin is installed you can create a new project by selecting
  63. File -> New -> Project... -> Vaadin 7 Project. In the dialog you will be
  64. presented you will need to provide a name for the project at least. You
  65. can also select which version of Vaadin should be used. By default the
  66. latest version is automatically selected. Click finish and the project
  67. is created.
  68. Once the project has been created you will still need to configure the
  69. project to use Ivy. To do this right click on the ivy.xml file in the
  70. newly created project and select "Add Ivy Library...". In the dialog
  71. that appears select Finish.
  72. One final thing needs to be done to ensure that the Ivy managed jars are
  73. deployed to your server and that is to add the project properties to the
  74. deployment assembly. This can be done by right clicking on the project
  75. and selecting Properties. In the properties dialog find the tab named
  76. "Deployment Assembly" and select "Add.." -> "Java Build Path Entries"
  77. and choose `ivy.xml[*]`. Click OK and your are done.
  78. Congratulations, you have just created a new Vaadin project!