title | order | layout |
---|---|---|
Using an IDE |
220 |
page |
This tutorial shows how to build, run and debug the application in an IDE. For a tutorial on how to build and run the application from the command line see the Running, building and packaging page.
Extract the project zip downloaded from https://vaadin.com/start/latest and import it into your IDE
-
File → Import…
-
Maven → Existing Maven Projects
, press Next -
Select the path to the extracted archive folder and click finish.
After the application is opened in an IDE and all dependencies are resolved there are several ways to run it.
In Eclipse right click on the application folder in Package Explorer → Run As → Java Application. After that pick Application.java
as the entry point class.
In IntelliJ IDEA right click on Application.java
→ Run 'Application.main()' or click on the green arrow at the main
method line in the Application.java
.
Note
|
There is a known issue with IntelliJ IDEA when a provided dependency is not in the classpath (https://youtrack.jetbrains.com/issue/IDEA-107048). So, if you are using an IDEA build older than 181.1818 then it is necessary to set the compile scope for the spring-boot-starter-tomcat dependency. Since compile is the default scope in maven, the dependency should be defined in pom.xml as:
|
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
In Eclipse in Package Explorer right click on the application root folder or on the pom.xml
file. Choose Run As → Maven Build… and specify spring-boot:run
as the run goal. Give the configuration a name and click Run.
Once the Maven Run configuration is saved you can find it in Run Configurations
In IDEA, choose Run → Edit Configurations… in the main menu. Then in the Run/Debug Configuration dialog box, click +
on the toolbar and select Maven
as the configuration type. Enter spring-boot:run
as the command line and press Ok.
Press the green arrow to launch the app.
More about how to create and edit run/debug configuration in IntelliJ IDEA: https://www.jetbrains.com/help/idea/creating-and-editing-run-debug-configurations.html
To make a production build use the clean install -Pproduction
maven goal. After a production build is done in `application-folder-path/target' you can find the .war file which is ready to be deployed to an application server.
In Eclipse same configurations can be used but should be run from Debug configurations
.
In IDEA pick the configuration needed and click Debug Application
button.