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.

getting-started-idea.asciidoc 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. ---
  2. title: Creating a Project with IntelliJ IDEA
  3. order: 8
  4. layout: page
  5. ---
  6. [[getting-started.idea]]
  7. = Creating a Project with IntelliJ IDEA
  8. The Ultimate Edition of IntelliJ IDEA includes support for creating Vaadin
  9. applications and running or debugging them in an integrated application server.
  10. With the Community Edition, you can create a Vaadin application most easily with
  11. a Maven archetype and deploy it to a server with a Maven run/debug
  12. configuration.
  13. ifdef::web[]
  14. For more information, see the article "
  15. link:http://wiki.jetbrains.net/intellij/Creating_a_simple_Web_application_and_deploying_it_to_Tomcat[Creating
  16. a simple Web application and deploying it to Tomcat]" in the IntelliJ IDEA
  17. Encyclopedia wiki.
  18. endif::web[]
  19. [[getting-started.idea.server]]
  20. == Configuring an Application Server
  21. To run the application during development in the Ultimate Edition of IntelliJ
  22. IDEA, you first need to install and configure an application server that is
  23. integrated with the IDE. The edition includes integration with many commonly
  24. used application servers.
  25. In the following, we configure Apache Tomcat:
  26. . Download and extract Tomcat installation package to a local directory, as
  27. instructed in <<dummy/../../../framework/getting-started/getting-started-environment#getting-started.environment.tomcat,"Installing Apache Tomcat">>.
  28. . Select "Configure > Settings".
  29. . Select "IDE Settings > Application Servers".
  30. . Click [guibutton]#+# and select [guilabel]#Tomcat Server# to add a Tomcat server, or any of the other supported servers.
  31. A WebSocket-enabled server, such as Glassfish or TomEE, is required for server push.
  32. . In the Tomcat Server dialog, specify the home directory for the server.
  33. +
  34. image::img/idea-server-1.png[]
  35. +
  36. Click [guibutton]#OK#.
  37. . Review the application server settings page to check that it is OK.
  38. +
  39. image::img/idea-server-2.png[]
  40. +
  41. Then, click [guibutton]#OK#.
  42. [[getting-started.idea.project]]
  43. == Creating a Vaadin Web Application Project
  44. In the welcome page, do the following:
  45. . Download and exctract the Vaadin installation package to a local folder, as
  46. instructed in
  47. <<dummy/../../../framework/getting-started/getting-started-package#getting-started.package,"Vaadin
  48. Installation Package">>.
  49. . Select [menuchoice]#New Project#
  50. . In the [guilabel]#New Project# window, select [menuchoice]#Java#
  51. . Enter a [guilabel]#Project name# and [guilabel]#Project location#, and select
  52. the [guilabel]#Java SDK# to be used for the project. Vaadin requires at least
  53. Java 6. If you have not configured a Java SDK previously, you can configure it
  54. here.
  55. +
  56. image::img/idea-newproject-1.png[]
  57. +
  58. Click [guibutton]#Next#.
  59. . Select "Web Application > Vaadin" to add Vaadin technology to the project.
  60. . Select Vaadin [guilabel]#Version# and [guilabel]#Distribution# installation
  61. path. You probably also want an application stub, so select [guilabel]#Create
  62. sample application# and give a name for the generated UI class.
  63. +
  64. image::img/idea-newproject-2.png[]
  65. +
  66. Do __not__ click [guibutton]#Finish# yet.
  67. . Select [guilabel]#Application Server# in the same window. Set it as an
  68. integrated server that you have configured in IntelliJ IDEA, as described
  69. previously in <<getting-started.idea.server>>.
  70. ifdef::web[]
  71. +
  72. image::img/idea-newproject-3.png[]
  73. endif::web[]
  74. . Click [guibutton]#Finish#.
  75. The project is created with the UI class stub and a [filename]#web.xml#
  76. deployment descriptor.
  77. image::img/idea-newproject-4.png[]
  78. The wizard does not currently create a servlet class automatically, and uses
  79. Servlet 2.4 compatible deployment with a [filename]#web.xml# deployment
  80. descriptor.
  81. [[getting-started.idea.project.running]]
  82. === Deploying the Project
  83. To deploy the application to the integrated web server, right-click the
  84. [filename]#index.jsp# file in the project and select [menuchoice]#Run
  85. 'index.jsp'#. This starts the integrated server, if it was not already running,
  86. and launches the default browser with the application page.
  87. [[getting-started.idea.maven]]
  88. == Creating a Maven Project
  89. You can choose to create a Maven project in IntelliJ IDEA. This is the
  90. recommended way when using the Community Edition. You will not have the
  91. application server integration, but can deploy the application to an application
  92. server using a run/debug configuration.
  93. . Select [menuchoice]#New Project#
  94. . In the [guilabel]#New Project# window, select [menuchoice]#Maven#
  95. //&lt;?dbfo-need height="8cm" ?&gt;
  96. . Enter a project name, location, and the Java SDK to be used for the project.
  97. Vaadin requires at least Java 6.
  98. +
  99. image::img/idea-maven-newproject-1.png[]
  100. +
  101. Click [guibutton]#Next#.
  102. //&lt;?dbfo-need height="6cm" ?&gt;
  103. . Give a Maven [guilabel]#GroupID#, [guilabel]#ArtifactID#, and a
  104. [guilabel]#Version# for the project, or use the defaults.
  105. +
  106. image::img/idea-maven-newproject-2.png[]
  107. . Check [guilabel]#Create from archetype#
  108. //&lt;?dbfo-need height="6cm" ?&gt;
  109. . If the Vaadin archetype is not in the list, click [guibutton]#Add archetype#,
  110. enter [guilabel]#GroupId# [literal]#++com.vaadin++#, [guilabel]#ArtifactId#
  111. [literal]#++vaadin-archetype-application++#, and [guilabel]#Version#
  112. [literal]#++LATEST++# (or a specific version number).
  113. ifdef::web[]
  114. +
  115. image::img/idea-maven-newproject-3.png[]
  116. endif::web[]
  117. +
  118. Click [guibutton]#OK# in the dialog.
  119. //&lt;?dbfo-need height="8cm" ?&gt;
  120. . Select the [literal]#++com.vaadin:vaadin-archetype-application++#.
  121. ifdef::web[]
  122. +
  123. image::img/idea-maven-newproject-4.png[]
  124. endif::web[]
  125. +
  126. Click [guibutton]#Next#.
  127. //&lt;?dbfo-need height="8cm" ?&gt;
  128. . Review the general Maven settings and settings for the new project.
  129. You may need to override the settings, especially if you are creating a Maven project for the first time.
  130. ifdef::web[]
  131. +
  132. image::img/idea-maven-newproject-5.png[]
  133. endif::web[]
  134. +
  135. Click [guibutton]#Finish#.
  136. Creating the Maven project takes some time as Maven fetches the dependencies.
  137. Once done, the project is created and the Maven POM is opened in the editor.
  138. [[getting-started.idea.maven.compiling]]
  139. === Compiling the Project
  140. To compile a Vaadin application using Maven, you can define a run/debug
  141. configuration to execute a goal such as [literal]#++package++# to build the
  142. deployable WAR package. It will also compile the widget set and theme, if
  143. necessary. See
  144. <<dummy/../../../framework/getting-started/getting-started-maven#getting-started.maven.compiling,"Compiling
  145. and Running the Application">> for more details.
  146. Compilation is included in the following instructions for deploying the
  147. application.
  148. [[getting-started.idea.maven.deploying]]
  149. === Deploying to a Server
  150. There exists Maven plugins for deploying to various application servers. For
  151. example, to deploy to Apache Tomcat, you can to configure the
  152. [literal]#++tomcat-maven-plugin++# and then execute the
  153. [literal]#++tomcat:deploy++# goal. See the documentation of the plugin that you
  154. use for more details. If no Maven plugin exists for a particular server, you can
  155. always use some lower-level method to deploy the application, such as running an
  156. Ant task.
  157. In the following, we create a run/debug configuration to build, deploy, and
  158. launch a Vaadin Maven application on the light-weight Jetty web server.
  159. . Select "Run > Edit Configurations".
  160. . Click [guibutton]#+# and select menu:Maven[] to create a new Maven run/debug configuration.
  161. . Enter a [guilabel]#Name# for the run configuration.
  162. For the [guilabel]#Command line#, enter "`package jetty:run`# to first compile and package the project, and then launch Jetty to run it.
  163. ifdef::web[]
  164. +
  165. image::img/idea-maven-run-1.png[]
  166. endif::web[]
  167. +
  168. Click [guibutton]#OK#.
  169. . Select the run configuration in the toolbar and click the [guibutton]#Run#
  170. button beside it.
  171. ifdef::web[]
  172. +
  173. image::img/idea-maven-run-2.png[]
  174. endif::web[]
  175. Compiling the project takes some time on the first time, as it compiles the
  176. widget set and theme. Once the run console pane informs that Jetty Server has
  177. been started, you can open the browser at the default URL
  178. http://localhost:8080/.