Getting started with Vaadin 8.0.1 and IntelliJ IntelliJ IDEA 2017.1 EAP

I am feeling totally helpless at getting my first Vaadin project going with IntelliJ. I am trying to use the public pre-release of IntelliJ 2017.1 Ultimate with Vaadin 8.0.1.

I have done work successfully with Vaadin 7 and NetBeans 8.2 but would really like to try IntelliJ as
NetBeans has a terrible time getting along with Tomcat 8.0/8.5
.

I tried these instructions on:
https://www.jetbrains.com/help/idea/2016.1/getting-started-with-vaadin-maven-project.html

And I tried creating a Maven project by command-line per this Vaadin page:
https://vaadin.com/framework/get-started
…and then importing the generated Maven project into IntelliJ. I did not get even close to running my Vaadin project in either approach.

Is there any

very
specific,
very
detailed, explain-it-to-me-like-I-am-a-five-year-old, instructions
for getting started with Vaadin 8 in IntelliJ 2017 (2017.1 or 2017.0)?

I mean specifically:

  • Create a new example Vaadin app
  • Build the project
  • Clean-and-build the project
  • Run the project with a separate Tomcat installation
  • Stop running after things go well
  • Stop the Tomcat server manually if things go haywire

Hi,

it’s not exactly what you ask for, but have you seen this page in the docs:
https://vaadin.com/docs/-/part/framework/getting-started/getting-started-idea.html
?

Regards,

Olli

See this video on YouTube, published officially by the Vaadin company. No name given for the presenter.


Creating web applications with Vaadin in IntelliJ IDEA

This video does indeed present exactly what to do to start a new project, from installing IntelliJ, copying and modifying the example Maven command line, running Maven to generate a new example project, import the Maven project into IntelliJ, and finally run the app using the bundled Maven “jetty:run” plugin command including how to make a Run/Debug configuration for that command.

This approach shown in this video makes no use of the Vaadin plugin for IntelliJ (at least not visible to me).

His screenshots are clear and show all the necessary details. I used this video today to get Vaadin 8.0.2 working with IntelliJ 2017.1 Public Preview. I used the
Ultimate
edition of IntelliJ, but the video uses the free-of-cost open-source
Community
edition.

The only thing he does not show is that you must install Maven. I installed apache-maven-3.3.9. To run the newly installed Maven, you will likely want to alter your PATH environment variable. See
this Question on AskDifferent.com
for discussion of ways to do so, at least on macOS. I used: export PATH=$PATH:/folder/you/want within the Terminal.app session.

You can skip over the parts where he changes the code of the example app.

Tip: IntelliJ projects are commonly stored in a folder ~/IdeaProjects. So you may want to put your Maven project there, but optional.

Just to give credit where it’s due, the presenter in that video is Alejandro Duarte, who is great.

I recommend using Maven. There are instructions on how to create a Vaadin project using Maven here https://vaadin.com/maven

Then import the project into IntelliJ or som other Ide.

Also it’s very easy to use Spring Initializr, even from within IntelliJ. Just juse the wizard, and select Vaadin package from Spring Boot options.

To jon martin solaas, yes pure Maven in the only way that works for me. Unfortuately only Maven from the command-line tool works. I did have to download and install the latest Maven.

Finding a Maven archetypte for Vaadin from within IntelliJ is not easy. But when I did finally find and execute the archetype from within IntelliJ, it generated a much different, short, and useless POM file.

Running Maven outside of IntelliJ, from the command-line, produces a project with a proper POM file.

So:

  1. Install Maven on your machine.
  2. Copy the suggested mvn line from the Vaadin site, and massage in a text-editor to configure your project name etc.
  3. At the command-line (Terminal app), use cd to change directory to be where you want the project to live.
  4. Copy-paste from the text-editor to the command-line to create your Vaadin project.
  5. Open IntelliJ, and use the Import feature, pointing to that new project folder.
export PATH=$PATH:/Users/your-username/Documents/Tools/apache-maven-3.3.9/bin
which mvn
cd ~/IntelliJProjects/
mvn -B org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=8.0.5 -DgroupId=com.example.whatever -DartifactId=whatever -Dversion=1.0-SNAPSHOT

If the generated pom.xml is different, it has to do with different archetypes, not with running maven inside or outside IntelliJ. Also the Maven that comes with IntelliJ is exactly the same as you can download and install yourself. (Except they may not have upgraded to 3.5.0 yet …). And you can have IntelliJ use an external installastion of Maven instead of the builtin version (useful when new versions are released)

When your project is finished the pom.xml (you may even have several pom.xmls) will likely be a suitable template for your next project. One does not often start out with the Vaadin archetype in a new project. Most likely you’ll want to run in some sort of framework or container, like Spring or JEE. There are many example projects for Vaadin+Wildfly on github where you can look at the pom-files, or for Spring, you can have Spring Initializr generate a working set up. The latter is actually useable for real-world projects, and not just hello-world programs. (There is also a similar function for Wildfly Swarm I think, but maybe not as mature?)

Remember that Maven is your tool for building and dependency management, the ide is for coding. And there exist some integration between the two of them. This way you are not so dependent on the IDE. Earlier, the Vaadin Designer plugin wasn’t available for IntelliJ, so when using it, I would use the plugin in Eclipse and do the coding in IntelliJ. With Maven projects this is perfectly possible. But Maven is not 110% integrated into any IDE as far as I know, so you’ll end up on the command line every now and then, whichever IDE you choose.