123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- ---
- title: Creating a Project with IntelliJ IDEA
- order: 8
- layout: page
- ---
-
- [[getting-started.idea]]
- = Creating a Project with IntelliJ IDEA
-
- The Ultimate Edition of IntelliJ IDEA includes support for creating Vaadin
- applications and running or debugging them in an integrated application server.
- 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.
-
- ifdef::web[]
- For more information, see the article "
- link:http://wiki.jetbrains.net/intellij/Creating_a_simple_Web_application_and_deploying_it_to_Tomcat[Creating
- a simple Web application and deploying it to Tomcat]" in the IntelliJ IDEA
- Encyclopedia wiki.
- endif::web[]
-
- [[getting-started.idea.server]]
- == Configuring an Application Server
-
- To run the application during development in the Ultimate Edition of IntelliJ
- IDEA, you first need to install and configure an application server that is
- integrated with the IDE. The edition includes integration with many commonly
- used application servers.
-
- In the following, we configure Apache Tomcat:
-
- . Download and extract Tomcat installation package to a local directory, as
- instructed in <<dummy/../../../framework/getting-started/getting-started-environment#getting-started.environment.tomcat,"Installing Apache Tomcat">>.
-
- . Select "Configure > Settings".
-
- . Select "IDE Settings > Application Servers".
-
- . Click [guibutton]#+# and select [guilabel]#Tomcat Server# to add a Tomcat server, or any of the other supported servers.
- A WebSocket-enabled server, such as Glassfish or TomEE, is required for server push.
-
- . In the Tomcat Server dialog, specify the home directory for the server.
-
- +
- image::img/idea-server-1.png[]
-
- +
- Click [guibutton]#OK#.
-
- . Review the application server settings page to check that it is OK.
-
- +
- image::img/idea-server-2.png[]
-
- +
- Then, click [guibutton]#OK#.
-
-
-
- [[getting-started.idea.project]]
- == Creating a Vaadin Web Application Project
-
- In the welcome page, do the following:
-
- . Download and exctract the Vaadin installation package to a local folder, as
- instructed in
- <<dummy/../../../framework/getting-started/getting-started-package#getting-started.package,"Vaadin
- Installation Package">>.
-
- . Select [menuchoice]#New Project#
-
- . In the [guilabel]#New Project# window, select [menuchoice]#Java#
-
- . Enter a [guilabel]#Project name# and [guilabel]#Project location#, and select
- the [guilabel]#Java SDK# to be used for the project. Vaadin requires at least
- Java 6. If you have not configured a Java SDK previously, you can configure it
- here.
-
- +
- image::img/idea-newproject-1.png[]
-
- +
- Click [guibutton]#Next#.
-
- . Select "Web Application > Vaadin" to add Vaadin technology to the project.
-
- . Select Vaadin [guilabel]#Version# and [guilabel]#Distribution# installation
- path. You probably also want an application stub, so select [guilabel]#Create
- sample application# and give a name for the generated UI class.
-
- +
- image::img/idea-newproject-2.png[]
-
- +
- Do __not__ click [guibutton]#Finish# yet.
-
- . Select [guilabel]#Application Server# in the same window. Set it as an
- integrated server that you have configured in IntelliJ IDEA, as described
- previously in <<getting-started.idea.server>>.
-
- ifdef::web[]
- +
- image::img/idea-newproject-3.png[]
- endif::web[]
-
- . Click [guibutton]#Finish#.
-
-
- The project is created with the UI class stub and a [filename]#web.xml#
- deployment descriptor.
-
- image::img/idea-newproject-4.png[]
-
- The wizard does not currently create a servlet class automatically, and uses
- Servlet 2.4 compatible deployment with a [filename]#web.xml# deployment
- descriptor.
-
- [[getting-started.idea.project.running]]
- === Deploying the Project
-
- To deploy the application to the integrated web server, right-click the
- [filename]#index.jsp# file in the project and select [menuchoice]#Run
- 'index.jsp'#. This starts the integrated server, if it was not already running,
- and launches the default browser with the application page.
-
-
-
- [[getting-started.idea.maven]]
- == Creating a Maven Project
-
- You can choose to create a Maven project in IntelliJ IDEA. This is the
- recommended way when using the Community Edition. You will not have the
- application server integration, but can deploy the application to an application
- server using a run/debug configuration.
-
- . Select [menuchoice]#New Project#
-
- . In the [guilabel]#New Project# window, select [menuchoice]#Maven#
- //<?dbfo-need height="8cm" ?>
-
- . Enter a project name, location, and the Java SDK to be used for the project.
- Vaadin requires at least Java 6.
- +
- image::img/idea-maven-newproject-1.png[]
- +
- Click [guibutton]#Next#.
- //<?dbfo-need height="6cm" ?>
-
- . Give a Maven [guilabel]#GroupID#, [guilabel]#ArtifactID#, and a
- [guilabel]#Version# for the project, or use the defaults.
-
- +
- image::img/idea-maven-newproject-2.png[]
-
- . Check [guilabel]#Create from archetype#
- //<?dbfo-need height="6cm" ?>
-
- . If the Vaadin archetype is not in the list, click [guibutton]#Add archetype#,
- enter [guilabel]#GroupId# [literal]#++com.vaadin++#, [guilabel]#ArtifactId#
- [literal]#++vaadin-archetype-application++#, and [guilabel]#Version#
- [literal]#++LATEST++# (or a specific version number).
-
- ifdef::web[]
- +
- image::img/idea-maven-newproject-3.png[]
- endif::web[]
-
- +
- Click [guibutton]#OK# in the dialog.
- //<?dbfo-need height="8cm" ?>
-
- . Select the [literal]#++com.vaadin:vaadin-archetype-application++#.
-
- ifdef::web[]
- +
- image::img/idea-maven-newproject-4.png[]
- endif::web[]
-
- +
- Click [guibutton]#Next#.
- //<?dbfo-need height="8cm" ?>
-
- . Review the general Maven settings and settings for the new project.
- You may need to override the settings, especially if you are creating a Maven project for the first time.
-
- ifdef::web[]
- +
- image::img/idea-maven-newproject-5.png[]
- endif::web[]
- +
- Click [guibutton]#Finish#.
-
- Creating the Maven project takes some time as Maven fetches the dependencies.
- Once done, the project is created and the Maven POM is opened in the editor.
-
- [[getting-started.idea.maven.compiling]]
- === Compiling the Project
-
- To compile a Vaadin application using Maven, you can define a run/debug
- configuration to execute a goal such as [literal]#++package++# to build the
- deployable WAR package. It will also compile the widget set and theme, if
- necessary. See
- <<dummy/../../../framework/getting-started/getting-started-maven#getting-started.maven.compiling,"Compiling
- and Running the Application">> for more details.
-
- Compilation is included in the following instructions for deploying the
- application.
-
-
- [[getting-started.idea.maven.deploying]]
- === Deploying to a Server
-
- There exists Maven plugins for deploying to various application servers. For
- example, to deploy to Apache Tomcat, you can to configure the
- [literal]#++tomcat-maven-plugin++# and then execute the
- [literal]#++tomcat:deploy++# goal. See the documentation of the plugin that you
- use for more details. If no Maven plugin exists for a particular server, you can
- always use some lower-level method to deploy the application, such as running an
- Ant task.
-
- In the following, we create a run/debug configuration to build, deploy, and
- launch a Vaadin Maven application on the light-weight Jetty web server.
-
- . Select "Run > Edit Configurations".
-
- . Click [guibutton]#+# and select menu:Maven[] to create a new Maven run/debug configuration.
-
- . Enter a [guilabel]#Name# for the run configuration.
- For the [guilabel]#Command line#, enter "`package jetty:run`# to first compile and package the project, and then launch Jetty to run it.
-
- ifdef::web[]
- +
- image::img/idea-maven-run-1.png[]
- endif::web[]
-
- +
- Click [guibutton]#OK#.
-
- . Select the run configuration in the toolbar and click the [guibutton]#Run#
- button beside it.
-
- ifdef::web[]
- +
- image::img/idea-maven-run-2.png[]
- endif::web[]
-
-
- Compiling the project takes some time on the first time, as it compiles the
- widget set and theme. Once the run console pane informs that Jetty Server has
- been started, you can open the browser at the default URL
- http://localhost:8080/.
|