您的位置:首页 > 其它

Maven--要点笔记

2015-07-23 16:38 302 查看
--maven笔记

1.maven命令

2.archetype插件:用于创建符合maven规定的目录骨架

命令: mvn archetype:generate

3.

坐标:构件

仓库: 本地仓库和远程仓库

镜像仓库 :http://maven.net.cn/content/groups/public

更改本地仓库位置

4.maven生命周期:

clean 清理项目

pre-clean 执行清理前的工作

clean 清理上一次构建生成的文件

post-clean 执行清理后的文件

default 构建项目(核心)

compile test package install

site 生成项目站点

pre-site 在生成项目站点前要完成的工作

site 生成项目的站点文件

post-site 在生成项目站点后要完成的工作

site-deploy 发布生成的站点到服务器上

5.maven提供的一些插件

6.pox.xml解析:

设置依赖是否可选

<optional>

排除依赖传递列表

<exclusions> <exclusion>

依赖管理

<dependencies> <dependency>

插件

<build> <plugins> <plugin>

子模块继承父模块

<parent>

模块

<modules> <module>

依赖范围: --参数(compile(默认)\provided(编译、测试有效)\runtime(测试、运行)\test(测试)\system(编译、测试、可移植差)\import(导入的范围,只使用在dependencyManagement中,表示从其他的pom中导入dependency配置))

<scope>

依赖传递 :

依赖冲突:

原则:

短路优先,

先声明先优先(路径长度一样)

7.聚合和继承

聚合(modules module标签)

继承

举个例子:

--父类pom:

<properties>

<junit.version>4.0.0</junit.version>

</properties>

<dependencyManagement>

<dependencies>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>${junit.version}</version>

</dependency>

<dependencies>

</dependencyManagement>

--子类pom:

<parent>

父pom坐标

</parent>

8.maven使用Jetty 和 tomcat服务运行web项目
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: