maven eclipse web项目流程(简化内容)

时间:2023-11-11 16:15:02

1.maven eclipse 环境搭建

  1.1 下载解压配置环境变量(解压、环境变量maven目录到bin、setting.xml 改本地仓库)

  1.2 eclipse插件安装配置(link安装、加载本地maven目录、加载配置文件)

2.新建maven web 项目(新建maven项目,下一步,找下图(filter:web)、创建),

maven eclipse web项目流程(简化内容)

    转为dynamic web   项目(缺少文件夹,新建sources folder:)

    maven eclipse web项目流程(简化内容)

    添加web容器插件jetty(或tomcat)

    clean package 启动

 

<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>my.maven.test2</groupId>
<artifactId>test2</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>test2 Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>test2</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>