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 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. ---
  2. title: Creating a Project in IntelliJ
  3. order: 120
  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 applications and running or debugging them in an integrated application server.
  9. With the Community Edition, you can create a Vaadin application most easily with a Maven archetype and deploy it to a server with a Maven run/debug configuration.
  10. [[getting-started.idea.project]]
  11. == Creating a Vaadin Web Application Project
  12. In the welcome page, do the following:
  13. . Download and extract the Vaadin installation package to a local folder, as
  14. instructed in <<dummy/../../../framework/getting-started/getting-started-package#getting-started.package,"Vaadin Installation Package">>.
  15. . Select [menuchoice]#New Project#
  16. . In the [guilabel]#New Project# window, select [menuchoice]#Java#
  17. . Enter a [guilabel]#Project name# and [guilabel]#Project location#, and select
  18. the [guilabel]#Java SDK# to be used for the project.
  19. Vaadin requires at least Java 8.
  20. If you have not configured a Java SDK previously, you can configure it here.
  21. +
  22. image::img/idea-newproject-1.png[scaledwidth=100%]
  23. +
  24. Click [guibutton]#Next#.
  25. . Select "Web Application > Vaadin" to add Vaadin Framework to the project.
  26. . Select Vaadin [guilabel]#Version# and [guilabel]#Distribution# installation
  27. path. You probably also want an application stub, so select [guilabel]#Create
  28. sample application# and give a name for the generated UI class.
  29. +
  30. image::img/idea-newproject-2.png[scaledwidth=100%]
  31. +
  32. Do __not__ click [guibutton]#Finish# yet.
  33. . Select [guilabel]#Application Server# in the same window.
  34. Set it as an integrated server that you have configured in IntelliJ IDEA, as described previously in <<DUMMY/../../../framework/installing/installing-idea#installing.idea.ultimate.server, "Configuring an Application Server">>.
  35. . Click [guibutton]#Finish#.
  36. The project is created with the UI class stub and a [filename]#web.xml#
  37. deployment descriptor.
  38. image::img/idea-newproject-4.png[scaledwidth=100%]
  39. The wizard does not currently create a servlet class automatically, and uses
  40. Servlet 2.4 compatible deployment with a [filename]#web.xml# deployment
  41. descriptor.
  42. [[getting-started.idea.project.running]]
  43. === Deploying the Project
  44. To deploy the application to the integrated web server, right-click the
  45. [filename]#index.jsp# file in the project and select [menuchoice]#Run
  46. 'index.jsp'#. This starts the integrated server, if it was not already running,
  47. and launches the default browser with the application page.
  48. [[getting-started.idea.maven]]
  49. == Creating a Maven Project
  50. You can choose to create a Maven project in IntelliJ IDEA. This is the
  51. recommended way when using the Community Edition. You will not have the
  52. application server integration, but can deploy the application to an application
  53. server using a run/debug configuration.
  54. . Select [menuchoice]#New Project#
  55. . In the [guilabel]#New Project# window, select [menuchoice]#Maven#
  56. //&lt;?dbfo-need height="8cm" ?&gt;
  57. . Enter a project name, location, and the Java SDK to be used for the project.
  58. Vaadin requires at least Java 8.
  59. +
  60. image::img/idea-maven-newproject-1.png[scaledwidth=100%]
  61. +
  62. Click [guibutton]#Next#.
  63. //&lt;?dbfo-need height="6cm" ?&gt;
  64. . Give a Maven [guilabel]#GroupID#, [guilabel]#ArtifactID#, and a
  65. [guilabel]#Version# for the project, or use the defaults.
  66. +
  67. image::img/idea-maven-newproject-2.png[scaledwidth=100%]
  68. . Check [guilabel]#Create from archetype#
  69. //&lt;?dbfo-need height="6cm" ?&gt;
  70. . If the Vaadin archetype is not in the list, click [guibutton]#Add archetype#,
  71. enter [guilabel]#GroupId# [literal]#++com.vaadin++#, [guilabel]#ArtifactId#
  72. [literal]#++vaadin-archetype-application++#, and [guilabel]#Version#
  73. [literal]#++LATEST++# (or a specific version number).
  74. +
  75. Click [guibutton]#OK# in the dialog.
  76. //&lt;?dbfo-need height="8cm" ?&gt;
  77. . Select the [literal]#++com.vaadin:vaadin-archetype-application++#.
  78. +
  79. Click [guibutton]#Next#.
  80. //&lt;?dbfo-need height="8cm" ?&gt;
  81. . Review the general Maven settings and settings for the new project.
  82. You may need to override the settings, especially if you are creating a Maven project for the first time.
  83. +
  84. Click [guibutton]#Finish#.
  85. Creating the Maven project takes some time as Maven fetches the dependencies.
  86. Once done, the project is created and the Maven POM is opened in the editor.
  87. [[getting-started.idea.maven.compiling]]
  88. === Compiling the Project
  89. To compile a Vaadin application using Maven, you can define a run/debug
  90. configuration to execute a goal such as [literal]#++package++# to build the
  91. deployable WAR package. It will also compile the widget set and theme, if
  92. necessary. See
  93. <<dummy/../../../framework/getting-started/getting-started-maven#getting-started.maven.compiling,"Compiling
  94. and Running the Application">> for more details.
  95. Compilation is included in the following instructions for deploying the
  96. application.
  97. [[getting-started.idea.maven.deploying]]
  98. === Deploying to a Server
  99. There exists Maven plugins for deploying to various application servers. For
  100. example, to deploy to Apache Tomcat, you can to configure the
  101. [literal]#++tomcat-maven-plugin++# and then execute the
  102. [literal]#++tomcat:deploy++# goal. See the documentation of the plugin that you
  103. use for more details. If no Maven plugin exists for a particular server, you can
  104. always use some lower-level method to deploy the application, such as running an
  105. Ant task.
  106. In the following, we create a run/debug configuration to build, deploy, and
  107. launch a Vaadin Maven application on the light-weight Jetty web server.
  108. . Select "Run > Edit Configurations".
  109. . Click [guibutton]#+# and select menu:Maven[] to create a new Maven run/debug configuration.
  110. . Enter a [guilabel]#Name# for the run configuration.
  111. For the [guilabel]#Command line#, enter "`package jetty:run`# to first compile and package the project, and then launch Jetty to run it.
  112. +
  113. Click [guibutton]#OK#.
  114. . Select the run configuration in the toolbar and click the [guibutton]#Run#
  115. button beside it.
  116. Compiling the project takes some time on the first time, as it compiles the
  117. widget set and theme. Once the run console pane informs that Jetty Server has
  118. been started, you can open the browser at the default URL
  119. http://localhost:8080/.