使用命令创建webapp工程: 到workdpace运行命令
[b][color=red]mvn archetype:create -DgroupId=com.pandy -DartifactId=MavenDemo -DarchetypeArtifactId=maven-archetype-webapp[/color][/b]
使用maven构建web项目实例 [url]http://hnzhoujunmei.iteye.com/blog/1422446[/url]
配合m2eclipse创建一个标准的maven web项目: [url]http://liukai.iteye.com/blog/972914[/url]
使用maven构建web项目实例 [url]http://hnzhoujunmei.iteye.com/blog/1422446[/url]
设置maven管理的web项目在eclipse中用tomcat发布: [url]http://chinahgf.iteye.com/blog/645828[/url]
自定义tomcat端口
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<uriEncoding>UTF-8</uriEncoding>
<path>/monitor</path>
<!--在这里定义端口号 -->
<port>8089</port>
</configuration>
/plugin>
[color=red][b]这里是使用eclipse+maven+spring+mybatis管理的web项目简单实现[/b][/color]:
[url]http://www.blogjava.net/bolo/archive/2011/05/23/349655.html[/url]
[url]http://www.blogjava.net/bolo/archive/2011/06/01/351028.html[/url]
使用第一个地址的方法,得到附件的东西. 附件是一个:Eclipse+Maven+SpringMVC+MyBatis(还没实现MyBatis功能,哈哈)的例子.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pas</groupId>
<artifactId>ssm3</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>ssm3 Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.2.1.RELEASE</spring.version>
<mybatis.version>3.1.1</mybatis.version>
<mybatis.spring.version>1.1.1</mybatis.spring.version>
<aspectj.version>1.6.10</aspectj.version>
<jetty.version>6.1.26</jetty.version>
<tomcat.version>2.1-SNAPSHOT</tomcat.version>
<junit.version>3.8.1</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis.spring.version}</version>
</dependency>
<!-- <dependency> <groupId>org.aspectj</groupId> <artifactId>acpectjrt</artifactId>
<version>${aspectj.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId>
<artifactId>acpectjweaver</artifactId> <version>${aspectj.version}</version>
</dependency> -->
</dependencies>
<build>
<finalName>ssm3</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>${jetty.version}</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>${tomcat.version}</version>
</plugin>
<plugin>
<!-- 注解支持,jdk5才具有的新特性,我们需要设置compile插件,具体可以参考Setting the -source and
-target of the Java Compiler,根据说明,我们继续向pom文件中加入 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>5</source>
<target>5</target>
</configuration>
</plugin>
<plugin>
<!-- 我们想将所有的依赖库都打包,直接交给用户,这样用户不需要在做其他设置了,这里需要使用Assembly插件了,其说明参考Pre-defined
Descriptor Files,这个参考文件也说明了有四种默认定义的打包方式,我们选择jar-with-dependencies,继续添加pom文件 -->
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>$/lib</outputDirectory>
<!-- 拷贝所以依赖存放位置 -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
标签:Web,工程,url,spring,springframework,Maven,version,org,maven
From: https://blog.51cto.com/u_3871599/6338663