Web项目中引入maven依赖管理

来源:互联网 发布:linux显示文件内容命令 编辑:程序博客网 时间:2024/05/16 15:30

本人亲测有效

  • 先新建一个maven project

  • 修改.project文件:将以下maven工程下.project代码拷贝到web工程根路径下的 .project 文件中的
    标签下(如果代码存 在,则无须拷贝)

    <buildCommand>
    <name>org.maven.ide.eclipse.maven2Builder</name>
    <arguments></arguments> </buildCommand>

    将以下代码拷贝到工程根路径下的 .project 文件中的 标签下(如果代码存在 ,则无须拷贝)

    <nature>org.maven.ide.eclipse.maven2Nature</nature>
  • 修改.classspath文件
    根据maven工程的classpath文件,修改web项目下的.classpath文件

  • 重启myeclipse

  • 添加pom文件至于web项目中:
<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/xsd/maven-4.0.0.xsd">  <modelVersion>4.0.0</modelVersion>  <groupId>org.xxx</groupId>  <artifactId>org.xxx.xxx</artifactId>  <version>0.0.1-SNAPSHOT</version>  <packaging>jar</packaging>  <name>org.zhxie.mybaits.trymvn</name>  <url>http://maven.apache.org</url>  <properties>    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  </properties>  <dependencies>    <dependency>      <groupId>junit</groupId>      <artifactId>junit</artifactId>      <version>3.8.1</version>      <scope>test</scope>    </dependency>  </dependencies></project>
  • done
0 0
原创粉丝点击