使用 Vaadin 将 Maven 项目部署到 Tomcat
这可能是一个极其愚蠢的问题,但我有一个 Web 应用程序,它严重依赖 jQuery 来实现许多不同的小部件和美观实用程序,我正在尝试将其迁移到使用 Vaadin。对于初学者,我尝试使用 Vaadin 创建普通的“Hello World”应用程序(使用 Maven 构建并部署到 Tomcat),但我在部署它时遇到了问题。我一直在关注此处发布的教程( https://vaadin.com/book //page/intro.walkthrough.html )。到目前为止,这是我的文件结构:
HelloWorld
src
main
java
com
business
helloworld
HelloWorld.java
resources
webapp
WEB-INF
web.xml
test
target
pom.xml
我猜测我的问题出在我的 web.xml
中,如下所示:
web.xml
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>HelloWorld</display-name>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>HelloWorld</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
我已尽力遵循我所看到的示例,但是我有一种感觉,我正在犯一个愚蠢的错误。当我将项目作为 Maven 构建 (tomcat:redeploy) 运行时,它不会出现在我的 Tomcat 管理器中。有什么想法吗?如果您需要更多信息(例如我的 pom.xml 中的内容),请告诉我...
编辑:创建 Vaadin 项目并将其转换为 Maven 更好,还是反之亦然?
This may be an incredibly stupid question, but I have a web application that relies heavily on jQuery for many various widgets and aesthetic utilities that I'm trying to migrate into using Vaadin. For starters, I'm attempting to just create your run-of-the-mill "Hello World" application -- built with Maven and deployed to Tomcat -- with Vaadin, and I'm having a problem deploying it. I've been following the turtorial posted here ( https://vaadin.com/book/-/page/intro.walkthrough.html ). Here's my file structure thus far:
HelloWorld
src
main
java
com
business
helloworld
HelloWorld.java
resources
webapp
WEB-INF
web.xml
test
target
pom.xml
I'm guessing that my problem lies somewhere in my web.xml
that follows:
web.xml
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>HelloWorld</display-name>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>HelloWorld</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
I've tried my best to follow the examples I've seen, but I have a feeling I'm making a stupid mistake. When I run the project as a Maven Build (tomcat:redeploy), it doesn't appear in my Tomcat Manager. Any ideas? If you need any more information (like what's in my pom.xml), just let me know...
EDIT: Is it better to create a Vaadin Project and convert it to Maven, or vis versa?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应用程序参数值中的
MyApplicationClass
应该是完整的限定类名,例如(我在手机上,所以我没有检查语法,但应该是这样。)
编辑:对于第二个问题,有一个 Maven 原型可以创建 Maven
Vaadin
项目。通过使用它,您将不必以任何一种方式进行转换。MyApplicationClass
in application param-value should be the whole qualified class name, like(I'm on a mobile phone so I didn't check the syntax, but that should be it.)
Edit: To the second question, there's an Maven archetype that creates an Maven
Vaadin
project. By using that you won't have to convert either way.