如何在IntelliJ IDEA中启动新的vaadin项目?(How do I start a new vaadin project in IntelliJ IDEA?)

编程入门 行业动态 更新时间:2024-10-24 18:23:02
如何在IntelliJ IDEA中启动新的vaadin项目?(How do I start a new vaadin project in IntelliJ IDEA?)

基于Maven原型方法的答案很有用。 如果Vaadin的IntelliJ向导/模板已修复,我将更新并接受基于使用内置向导的答案。*

我设法使用终端窗口中的maven原型创建一个新项目,然后将其导入到IntelliJ IDEA中,配置GWT构面,但现在当我运行它时说:

"Error running unnamed: No GWT Modules found in 'projectname'"

我承认自己是Java,IntellIJ和Vaadin的初学者,更不用说GWT了。

我还尝试使用IntelliJ IDEA(Ultimate)附带的本地Vaadin插件创建新的Vaadin projet。 我正在使用Ultimate,但它是一个试用版。

更新::最初我看不到任何Vaadin项目在新项目窗口的可用项目模板列表中。 这是因为IntelliJ新项目向导中的两层新项目理念令我感到困惑。 现在整理出来。

Update2 ::我可以按照以下两个答案中的任何一个的步骤进行操作,并获得一个可以构建但不能运行的项目。 我假设我是正确的添加GWT运行目标,因为在此之前,运行菜单完全变灰。 我相信它是灰色的,因为GWT构面模块列表中没有列出模块。

我假设我必须创建一个新的运行/调试配置,它必须是下列之一,并且由于vaadin基于GWT,因此GWT具有一定的意义:

添加GWT之后,我仍然得到与从Maven原型开始时相同的错误:没有GWT模块。 我不知道人们在谈论从下拉模块中选择什么......

Update3仍然无法让下面的解决方案工作。 卡在屏幕上,无法显示“GWT模块加载”组合框中的任何模块,该组合框仍然呈灰色。 我相信这是我应该选择的下拉模块,但下面没有任何内容告诉我如何让它变成灰色(启用):

我最终设法(a)手动添加GWT构面,(b)配置它,并且(c)现在它将运行。 这会导致运行时错误(应用程序无法在Web浏览器中打开,但显然它非常接近工作。)

The answer based on the maven archetype approach works. I will update and accept an answer based on using the built in wizard if the IntelliJ wizard/template for Vaadin is ever fixed.*

I managed to create a new project using the maven archetype from a terminal window, and then import that into IntelliJ IDEA, configured the GWT facet, but now when I run it says:

"Error running unnamed: No GWT Modules found in 'projectname'"

I confess to being a total beginner at Java, IntellIJ, and Vaadin, not to mention GWT.

I also tried creating a new Vaadin projet using the native Vaadin plugin that comes with IntelliJ IDEA (Ultimate). I am using Ultimate, but it's a trial.

Update:: Originally I could not see any Vaadin projects in the New Project window's list of available project templates. That's because I was confused by the two-levels-of-new-projects idea in IntelliJ's new project wizard. Sorted that out now.

Update2:: I can follow the steps from EITHER of the two answers below and get a project that builds but it doesn't run. I assume I was right to add the GWT run-target, because before I do that the Run menu is entirely grayed out. I believe it is grayed out because there are no modules listed in the modules list for the GWT facet.

I assume that I must create a new Run/Debug configuration which must be one of the following, and GWT made some sense since vaadin is based atop GWT:

After I add the GWT I still get the same error as I got originally when I started from the maven archetype: No GWT modules. And I have no idea what people are talking about picking from a drop down module...

Update3 Still was unable to get either solution below to work. Stuck at this screen and unable to get it to show any modules in the "GWT modules to load" combo box which remains grayed out. I believe this is the drop down module that I am supposed to pick, but nothing below tells me how to get it to be un-grayed-out (enabled):

I eventually managed to (a) add the GWT facet manually, (b) configure it, and (c) now it will run. That leads to a runtime error (the app does not open in the web browser, but it is clear that it's very close to working.)

最满意答案

以下是我如何做到这一点。

首先使用maven artefact创建Vaadin项目。

C:\dev> mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.0.4 -Dpackaging=war [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>> [INFO] [INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<< [INFO] [INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom --- [INFO] Generating project in Interactive mode [INFO] Archetype repository missing. Using the one from [com.vaadin:vaadin-archetype-application:7.0.4] found in catalog remote Define value for property 'groupId': : maba Define value for property 'artifactId': : vaadin-app Define value for property 'version': 1.0-SNAPSHOT: : Define value for property 'package': maba: : Confirm properties configuration: groupId: maba artifactId: vaadin-app version: 1.0-SNAPSHOT package: maba Y: : [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating project from Archetype: vaadin-archetype-application:7.0.4 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: maba [INFO] Parameter: artifactId, Value: vaadin-app [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: package, Value: maba [INFO] Parameter: packageInPathFormat, Value: maba [INFO] Parameter: package, Value: maba [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: groupId, Value: maba [INFO] Parameter: artifactId, Value: vaadin-app [INFO] project created from Archetype in dir: C:\dev\vaadin-app [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 28.122s [INFO] Finished at: Fri Apr 19 08:05:49 CEST 2013 [INFO] Final Memory: 12M/152M [INFO] ------------------------------------------------------------------------ C:\dev>

然后进入新创建的目录并运行mvn install来获取所有依赖关系并重新开始。

c:\dev\vaadin-app> mvn install [INFO] Scanning for projects... ... ------ LOTS OF STUFF GOING ON ------ ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3:30.373s [INFO] Finished at: Fri Apr 19 08:13:07 CEST 2013 [INFO] Final Memory: 24M/296M [INFO] ------------------------------------------------------------------------

现在通过指向新创建的pom.xml来打开项目。

在这里输入图像描述

一切都很美好。 选择在右上角的绿色框中配置GWT框架。

在这里输入图像描述

现在选择Edit Configurations...下拉菜单。

在这里输入图像描述

选择GWT Configuration 。

在这里输入图像描述

给它一个名字并从下拉菜单中选择Module 。

在这里输入图像描述

现在你可以选择GWT Module to load两个选项。

在这里输入图像描述

我选择运行该应用程序。 在这种情况下,它会给你一个错误。

在这里输入图像描述

这似乎是目前已知的错误 。 您必须手动将vaadin-client-compiler.jar到类路径。

按下工具栏中的“ Project Structure按钮。

在这里输入图像描述

选择vaadin-app Dependencies选项卡并选择添加Jars or directories...

在这里输入图像描述

浏览到你的本地maven仓库并找到vaadin-client-compiler-<version>.jar 。

在Mac OS和Linux / Unix上,这可以在~/.m2/repository/com/vaadin/vaadin-client-compiler/7.0.4/...

在这里输入图像描述

在“ Project Structure窗口中再次按Ok并Ok 。

现在再次运行该应用程序。 没有更多的错误。

在这里输入图像描述


现在,我不是Vaadin的专家,所以从这里开始就是你自己的。

玩的开心!

Here's how I did this.

First create the Vaadin project using the maven artefact.

C:\dev> mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.0.4 -Dpackaging=war [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>> [INFO] [INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<< [INFO] [INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom --- [INFO] Generating project in Interactive mode [INFO] Archetype repository missing. Using the one from [com.vaadin:vaadin-archetype-application:7.0.4] found in catalog remote Define value for property 'groupId': : maba Define value for property 'artifactId': : vaadin-app Define value for property 'version': 1.0-SNAPSHOT: : Define value for property 'package': maba: : Confirm properties configuration: groupId: maba artifactId: vaadin-app version: 1.0-SNAPSHOT package: maba Y: : [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating project from Archetype: vaadin-archetype-application:7.0.4 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: maba [INFO] Parameter: artifactId, Value: vaadin-app [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: package, Value: maba [INFO] Parameter: packageInPathFormat, Value: maba [INFO] Parameter: package, Value: maba [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: groupId, Value: maba [INFO] Parameter: artifactId, Value: vaadin-app [INFO] project created from Archetype in dir: C:\dev\vaadin-app [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 28.122s [INFO] Finished at: Fri Apr 19 08:05:49 CEST 2013 [INFO] Final Memory: 12M/152M [INFO] ------------------------------------------------------------------------ C:\dev>

Then step into the newly created directory and run mvn install just to get all dependencies and have a fresh start.

c:\dev\vaadin-app> mvn install [INFO] Scanning for projects... ... ------ LOTS OF STUFF GOING ON ------ ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3:30.373s [INFO] Finished at: Fri Apr 19 08:13:07 CEST 2013 [INFO] Final Memory: 24M/296M [INFO] ------------------------------------------------------------------------

Now open the project by pointing to the newly created pom.xml.

enter image description here

Everything looks fine. Choose to configure the GWT framework in the green box in the upper right corner.

enter image description here

Now choose the Edit Configurations... drop-down.

enter image description here

Choose the GWT Configuration.

enter image description here

Give it a name and choose the Module from the drop-down.

enter image description here

Now you will have the option to choose GWT Module to load with two options at the moment.

enter image description here

I choose to run the application. In this case it will give you an error.

enter image description here

This seems to be a known error at the moment. You'll have to add the vaadin-client-compiler.jar to classpath manually.

Press the Project Structure button in the toolbar.

enter image description here

Select Dependencies tab for the vaadin-app and choose to add Jars or directories....

enter image description here

Navigate to your local maven repository and find the vaadin-client-compiler-<version>.jar.

On Mac OS and Linux/Unix, this will found at: ~/.m2/repository/com/vaadin/vaadin-client-compiler/7.0.4/...

enter image description here

Press Ok and Ok again in the Project Structure window.

Now once again run the application. No more errors.

enter image description here


Now, I'm not a Vaadin expert so from here you're on your own.

Have fun!

更多推荐

本文发布于:2023-07-28 18:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1307997.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   如何在   IntelliJ   vaadin   IDEA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!