<< 一月 2006 | 首页 | 三月 2006 >>

Maven2 一个完整的pom.xml

Maven2是一个很好的build工具,它简化了项目管理,用它的插件可生成各种报表,自动化测试等等。但是把已有的项目转移到Maven2上其实是一件痛苦的事情,但关键在于要理解 pom.xml文件。我的经验是,一旦你的应用包依赖搞定了的话,就用mvn -o site来离线进行maven2工作

安装第三方包:
mvn install:install-file -Dfile=E:/workdir/dg_new/主站/源代码/m2m/lib/mail-1.3.jar -DartifactId=javamail -Dversion=1.3.1 -Dpackaging=jar -DgroupId=javamail

遵循Maven2的规范源代码目录。

创建新项目:

mvn archetype:create -DgroupId=cas.security -DartifactId=securityApp -DarchetypeArtifactId=maven-archetype-webapp

cd securityApp

创建war文件:

mvn package

创建Eclipse项目文件:

mvn eclipse:eclipse

部署 webapps internal (so we can point the Context.xml file in tomcat to the source dir):

mvn war:inplace

mvn test

mvn compile

(The above should copy the jar files we need.)

Add M2_REPO to workspace:
mvn -Declipse.workspace=D:\workspaces\clientQ

eclipse:add-maven-repo

Maven文档:http://maven.apache.org/guides/getting-started/index.html

下面是一个完整的pom.xml:

阅读全文……

标签 :