Eclipse J2EE+Maven+Tomcat(Jetty)构建Spring MVC项目

一步一步的我们试着使用Eclipse J2EE+Maven+Tomcat(Jetty) 搭建留住的web开发平台 Spring MVC的方法。

工具:Eclipse J2EE,Maven,,Tomcat

Eclipse J2EE+Maven+Tomcat(Jetty):

Maven 3.3.3:

Tomcat 7.X:

1.安装基础环境:

没啥好说的,JDK,Eclipse,Maven,配置环境变量等。

2.打开Eclipse,做web开发,我们还需要安装一些插件。

Eclipse插件地址:Luna – (安装Web,XML,Java EE and OSGI Enterprise Development)

3.将Maven和Eclipse关联起来。略

4.新建Maven web项目。

5.修改pom.xml文件,将编译级别,需要的jar等信息写入pom.xml文件。然后Alt+F5刷新项目。

<?xml version="1.0" encoding="UTF-8"?><!– Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. –><!– $Id: pom.xml 642118 2008-03-28 08:04:16Z reinhard $ –><project xmlns="" xmlns:xsi=""xsi:schemaLocation=" http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><packaging>war</packaging><name>demo</name><groupId>com.springmvc</groupId><artifactId>demo</artifactId><version>0.0.1-SNAPSHOT</version><build><plugins><plugin><groupId>org.mortbay.jetty</groupId><artifactId>maven-jetty-plugin</artifactId><version>6.1.7</version><configuration><connectors><connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"><port>8888</port><maxIdleTime>30000</maxIdleTime></connector></connectors><webAppSourceDirectory>${project.build.directory}/${pom.artifactId}-${pom.version}</webAppSourceDirectory><contextPath>/</contextPath></configuration></plugin></plugins></build><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><springversion>3.1.1.RELEASE</springversion><junitversion>3.8.1</junitversion></properties><profiles><profile><id>jdk-1.7</id><activation><activeByDefault>true</activeByDefault><jdk>1.7</jdk></activation><properties><maven.compiler.source>1.7</maven.compiler.source><maven.compiler.target>1.7</maven.compiler.target><maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion></properties></profile></profiles><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>${junitversion}</version><scope>test</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-asm</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-expression</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-oxm</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>${springversion}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.1</version></dependency><dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId><version>1.1</version></dependency></dependencies></project>6.补全源码文件夹信息 (目前只有src/main/resources)

黄色蓝色或者砖红色,犹如童话世界。

Eclipse J2EE+Maven+Tomcat(Jetty)构建Spring MVC项目

相关文章:

你感兴趣的文章:

标签云: