(三)Maven基本概念——常用插件的配置
看注释————
pom.xml
<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>com.alanlee</groupId>
<artifactId>UidpWeb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging> <!-- maven属性的使用 -->
<properties>
<plugin.version>2.5</plugin.version>
</properties> <!-- 依赖配置的使用 -->
<dependencies> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<!-- 测试范围有效,在编译和打包时都不会使用这个依赖 -->
<scope>test</scope>
</dependency> <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<!-- 在编译和测试的过程有效,最后生成war包时不会加入 -->
<scope>provided</scope>
</dependency> <dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<!-- 在编译和测试的过程有效,最后生成war包时不会加入 -->
<scope>provided</scope>
</dependency> </dependencies> <!-- 用来支持项目发布到私服中,用来配合deploy插件的使用 -->
<distributionManagement>
<!-- 发布版本 -->
<repository>
<id>releases</id>
<name>public</name>
<url>http://10.200.11.21:8081/nexus/content/repositories/releases/</url>
</repository>
<!-- 快照版本 -->
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url>http://10.200.11.21:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement> <!-- 注意体会插件配置的顺序,这正体现了一个maven的运行流程 -->
<build>
<plugins>
<!-- 插件使用练习 -->
<!-- 清理插件的使用,maven3.0.4会默认使用2.4.1版本的clean插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${plugin.version}</version>
<executions>
<execution>
<id>auto-clean</id>
<!-- clean生命周期clean阶段 -->
<phase>clean</phase>
<goals>
<!-- 执行clean插件的clean目标 -->
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin> <!-- maven-resources-plugin在maven3.0.4中默认使用2.5版本的resources --> <!-- 编译插件的使用,maven3.0.4会默认使用2.3.2版本的compile插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.version}</version>
<configuration>
<!-- 源代码使用的jdk版本 -->
<source>1.7</source>
<!-- 构建后生成class文件jdk版本 -->
<target>1.7</target>
</configuration>
</plugin> <!-- maven-surefire-plugin插件,maven3.0.4默认使用2.10版本的surefire插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${plugin.version}</version>
<configuration>
<!-- 改变测试报告生成目录 ,默认为target/surefire-reports-->
<!-- project.build.directory表示maven的属性,这里指的是构建的目录下面test-reports,project.build.directory就是pom标签的值 -->
<reportsDirectory>${project.build.directory}/test-reports</reportsDirectory>
</configuration>
</plugin> <!-- war包插件的使用,maven3.0.4会默认使用xxx版本的war插件,建议配置编码格式和打包名称 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<!-- 利用属性传递版本号 -->
<version>${plugin.version}</version>
<configuration>
<!-- 设置编码 -->
<encoding>UTF-8</encoding>
<!-- 设置名称 -->
<warName>ROOT</warName>
</configuration>
</plugin> <!-- maven-install-plugin插件一般不需要配置,maven3.0.4默认使用2.3.1版本的install插件 --> <!-- 部署插件的使用,maven3.0.4会默认使用2.7版本的deploy插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${plugin.version}</version>
<configuration>
<!-- 更新元数据 -->
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin> </plugins>
</build> </project>
from: http://www.cnblogs.com/AlanLee/p/6428859.html
(三)Maven基本概念——常用插件的配置的更多相关文章
- maven常用插件pom配置
一.问题描述: 部署一个maven打包项目时,jar包,依赖lib包全部手动上传至服务器,然后用maven部署报错:Exception in thread "main" java. ...
- Maven常用插件简单配置
好久不见,甚是想念.一日不见,如隔三秋. 从春节到现在已经很久没有回归博客园了,今天回来温习一下maven常用的一些插件的配置,学东西一个很简单的诀窍就是重复重复再重复,这样一定能把知识掌握的很牢靠. ...
- Maven系列学习(三)Maven生命周期和插件
Maven生命周期和插件 Maven另外的两个核心概念就是生命周期和插件,Maven的生命周期都是抽象的,其实实际行为都是由插件来完成的,生命周期和插件两者协同工作 1.生命周期 Maven的生命周期 ...
- sublime常用插件及配置,自留自用
1.Angularjs 写angularjs经常操作template文件,没有一个ng-xx的提示真的很蛋疼是不是,有些服务的名字记不住是不是,那就用这个插件吧 2.AutoFileName 如果你的 ...
- Maven中常用插件的配置
在Maven项目的pom.xml文件中配置插件信息,使用<build></build>标签 1.配置JDK版本插件和Tomcat版本插件 <build> <! ...
- (三)Maven仓库介绍与本地仓库配置
1.Maven本地仓库/远程仓库的基本介绍 示意图: 本地仓库是指存在于我们本机的仓库,在我们加入依赖时候,首先会跑到我们的本地仓库去找,如果找不到则会跑到远程仓库中去找.对于依赖的包大家可以从这个地 ...
- sublime常用插件及配置
以下是我的sublime插件列表: SideBarEnhancements增强版侧边栏 这个插件官方不支持通过package安装了,只能手动了,下载地址https://github.com/S ...
- maven入门与常用插件使用
maven不仅仅是一款管理jar包的工具,还可以
- Sublime 常用插件及配置
一.把 tab 键修改转换成4个空格 1. 在菜单里选择 Preferences --> Settings 2. 在弹出来的设置面板选择右侧 --User,添加两行代码: "trans ...
随机推荐
- ZCMU训练赛-H(模拟)
H - Hard to Play MightyHorse is playing a music game called osu!. After playing for several months ...
- UVA 699 The Falling Leaves (递归先序建立二叉树)
题目链接:http://acm.hust.edu.cn/vjudge/problem/19244 #include <iostream> #include <cstdio> # ...
- RPD Volume 168 Issue 4 March 2016 评论4
Non-vascular interventional procedures: effective dose to patient and equivalent dose to abdominal o ...
- Linux CentOS下Python+robot framework环境搭建
转载自:http://blog.sina.com.cn/s/blog_13cc013b50102vof1.html 操作系统环境:CentOS 6.5-x86_64 下载地址:http://www.c ...
- [Contest20180325]序列
Hogura有一个序列$a$,她希望你帮她维护下面的这些操作. $1\ l\ r\ x$对$l\leq i\leq r$的$a_i$执行$a_i=a_i+x$ $2\ l\ r\ x$对$l\leq ...
- Problem X: 零起点学算法22——华氏摄氏温度转换
#include<stdio.h> int main() { float f,c; while(scanf("%f",&f)!=EOF) c=*(f-); pr ...
- 关于JS中原型链中的prototype与_proto_的个人理解与详细总结
一直认为原型链太过复杂,尤其看过某图后被绕晕了一整子,今天清理硬盘空间(渣电脑),偶然又看到这图,勾起了点回忆,于是索性复习一下原型链相关的内容,表达能力欠缺逻辑混乱别见怪(为了防止新人__(此处指我 ...
- jQuery--样式
Jquery(一)——样式篇1.$(document).ready 的作用是等页面的文档(document)中的节点都加载完毕后,再执行后续的代码, 因为我们在执行代码的时候,可能会依赖页面的某一个元 ...
- C# 7 新特性-1
来源https://www.kenneth-truyers.net/2016/01/20/new-features-in-c-sharp-7/ Tuples What Tuples是数据的临时分组.区 ...
- JavaScript里面向对象的继承:构造函数"继承"的六种方法
//现在有一个"动物"对象的构造函数. function Animal(){ this.species = "动物"; } //还有一个"猫" ...