帮助需要使用IntelliJ IDEA获得Spring MVC项目 [英] Help need to get Spring MVC project going with IntelliJ IDEA

查看:105
本文介绍了帮助需要使用IntelliJ IDEA获得Spring MVC项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我下载了一个想法终极试用版,我想让tom mvc与tomcat一起使用。

So I downloaded a trial of idea ultimate, and I want to get spring mvc going with tomcat.

所以我设置了一个新项目,将其配置为使用sun jdk。

So I setup a new project, configured it to use sun jdk.

我选择了一个弹簧应用程序,它创建并下载了以下内容:

I chose a spring application, and it created and downloaded the following:

http://img15.imageshack.us/img15/4853/idealspring1.png http://img15.imageshack.us/img15/4853 /idealspring1.png

我没有看到任何spring-mvc库,它们是否包含在那里或者我必须对此做些什么?

I don't see any spring-mvc libraries, are they included in there or do I have to do something about that?

有人可以概述我必须做些什么才能让它像Spring mvc web应用程序一样构建?

Can someone outline what I have to do to get this to build like a spring mvc web application?

推荐答案

我发现启动新IDEA项目的最佳方法是使用Maven。这使您可以轻松构建项目而无需启动IDE,自动为您维护所有库。

I find that the best way to start a new IDEA project is to use the Maven. This allows you to easily build your project without launching the IDE, automatically maintaining all libraries for you.

从头创建项目,然后选择Maven模块下一个屏幕。单击从原型创建并选择maven-archetype-webapp。这将为您提供一个基本的Maven布局,用于构建一个简单的WAR文件。

"Create project from scratch", then select "Maven module" in the next screen. Click on "Create from archetype" and select the "maven-archetype-webapp". This will give you a basic Maven layout which builds a simple WAR file.

现在添加Spring库,打开Maven构建文件--pom.xml - 并插入一个对Spring MVC框架的新依赖:

Now to add the Spring libraries, open the Maven build file - pom.xml - and insert a new dependency on the Spring MVC framework:

   <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.0.0.RELEASE</version>
    </dependency>

从这里,你可以按照 Spring MVC参考文档 - 将Dispatcher Servlet和Context Listener添加到web.xml, Spring XML上下文等等。

From here, you can follow the Spring MVC reference documentation - add the Dispatcher Servlet and Context Listener to web.xml, a Spring XML context and so on.

你可能会觉得有用的其他东西是 Maven Jetty插件。配置完成后,您只需在命令提示符下键入mvn jetty:run(或从IDE中启动它)即可运行您的应用程序。 Maven将获取所需的全部内容并为您部署应用程序,无需外部应用程序服务器设置即可进行快速测试。

Something else you might find useful is the Maven Jetty plugin. Once configured, you can run your app by simply typing "mvn jetty:run" at the command prompt (or launching it from within the IDE). Maven will fetch all that's required and deploy the app for you, no need for an external app server setup for quick testing.

这篇关于帮助需要使用IntelliJ IDEA获得Spring MVC项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆