Maven 功能及其语法
来源:互联网 发布:mac 电影 little boy 编辑:程序博客网 时间:2024/06/01 09:35
maven中有很多语法,这里我们说说一些常用的语法
依赖
<dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>4.3.3.Final</version></dependency>
屏蔽依赖传递
<dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>4.3.3.Final</version><exclusions><groupId>dom4j</groupId><artifactId>dom4j</artifactId><!--无需再声明版本--></exclusions></dependency>
构建有效范围
<dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>4.3.3.Final</version><scope>test</scope><!--scope标签声明为test,则依赖不会被传递。默认值是之compile,依赖会被传递--></dependency>
继承
<parent><!--指明父项目的坐标--><groupId>cn.wp.test</groupId><artifactId>parent</artifactId><version>0.0.1-SNAPSHOT</version><relativePath>../parent/pom.xml</relativePath></parent>
强制性继承(父pom.xml文件中直接添加依赖)
<dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>4.3.3.Final</version></dependency>
选择性继承(父pom.xml文件中添加依赖管理,子项目选择继承)
父项目<dependencyManagement><dependencies><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>4.3.3.Final</version></dependency></dependencies></dependencyManagement>子项目<dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><!--无需再声明版本--></dependency>
聚合
<modules><module>../main/pom.xml</module><!--指明模块项目的路径--><module>../model1/pom.xml</module><!--指明模块项目的路径--></modules>
发布
配置项目pom.xml(声明发布的仓库)
<distributionManagement><repository><!-- 发布版本发布仓库 --><id>wepu-releases</id><name>wepu-releases</name><url>http://192.168.41.191:8081/nexus/content/repositories/releases/</url></repository><snapshotRepository><!-- 快照版本发布仓库 --><id>wepu-snapshots</id><name>wepu-snapshots</name><url>http://192.168.41.191:8081/nexus/content/repositories/snapshots/</url></snapshotRepository></distributionManagement>
配置maven 工作区中 settings.xml(发布的权限)
<servers><server><id>wepu-releases</id><username>deployment</username><password>deployment123</password></server><server><id>wepu-snapshots</id><username>deployment</username><password>deployment123</password></server></servers>
配置 nexus 镜像
配置maven 工作区中 settings.xml
<mirrors><mirror><id>central</id><mirrorOf>*</mirrorOf> <!-- 对所有仓库镜像 --><name>central mirror</name><url>http://192.168.41.191:8081/nexus/content/groups/public/</url></mirror></mirrors>
0 0
- Maven 功能及其语法
- Maven语法
- XML语法及其约束
- 继承及其基本语法
- 认识Maven及其依赖
- maven语法详解pom
- oracle视图及其功能
- oracle视图及其功能
- Apache模块及其功能
- RFID系统及其功能
- MATLAB常用命令及其功能
- 计算机组成及其功能
- AudioPolicyService类及其功能
- 字符串语法功能
- shell 语法功能
- 常用功能/语法笔记
- WML元素及其语法格式
- CAML 语法说明 及其实例
- Huson安装配置
- Mantis 规范
- Hudson 配置javaEE 任务
- Nexus安装配置
- 安装Maven,配置eclipse插件
- Maven 功能及其语法
- Tesklink
- Ubuntu 安装sogou flash
- GIT命令
- RAID 磁盘阵列 级别
- 内核架构
- Ubuntu 修改ip 网关
- ubuntu 使用VPN
- 后台运行命令