JAVA MAVEN POM.XML中关于ANT的配置
2016-06-24 11:28
447 查看
<properties>
<!-- 文件拷贝时的编码 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- 编译时的编码 -->
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<projectDir>${basedir}</projectDir><!-- 项目目录 -->
<classesDir>target\classes</classesDir><!-- java 文件编译后输出目录 -->
<jspDir>src\main\webapp</jspDir><!-- jsp 及资源文件存放目录 -->
<artifactDir>gfzq-khda</artifactDir> <!-- 项目名称,可以自定义 -->
<outputDir>C:/Users/Administrator.AEOFY-512152003/Desktop/系统更新包/maven</outputDir><!-- 补丁打包输出目标目录 -->
<outputClassDir>WEB-INF\classes</outputClassDir><!-- class文件拷贝的目标目录 -->
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format> <!-- 时间格式 -->
<aftertime>${maven.build.timestamp} 11:09:41"</aftertime><!-- 配置时间 -->
</properties>
一、配置属性
二、在<build>标签中加入下面的代码,可以根据自己需要进行修改
<pluginManagement><!-- 如果有,不用加-->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>package-patch</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="删除目录${outputDir}"></echo>
<delete dir="${outputDir}"/>
<echo message="新建目录${outputDir}"></echo>
<mkdir dir="${outputDir}"/>
<echo message="复制class文件、JSP文件,以及资源文件" />
<copy includeemptydirs="false" todir="${outputDir}/${artifactDir}/${outputClassDir}" preservelastmodified="true">
<fileset dir="${classesDir}">
<or>
<date when = "after" datetime = "${aftertime}" pattern="yyyy-MM-dd HH:mm:ss" />
<!-- <date when = "before" datetime = "${beforetime}" pattern="yyyy-MM-dd HH:mm:ss" />-->
</or>
</fileset>
</copy>
<copy includeemptydirs="false" todir="${outputDir}/${artifactDir}" preservelastmodified="true">
<fileset dir="${jspDir}">
<or>
<date when = "after" datetime = "${aftertime}" pattern="yyyy-MM-dd HH:mm:ss" />
<!-- <date when = "before" datetime = "${beforetime}" pattern="yyyy-MM-dd HH:mm:ss" />-->
</or>
</fileset>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
三、执行补丁打包命令
1、方式一:在DOS命令窗口,进入的项目的根目录,然后执行命令 mvn antrun:run@package-patch
注意:package-patch 为 execution 下的 id
2、方式二:在ECLIPSE/MYECLIPSE中,增设一个run,如下图
<!-- 文件拷贝时的编码 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- 编译时的编码 -->
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<projectDir>${basedir}</projectDir><!-- 项目目录 -->
<classesDir>target\classes</classesDir><!-- java 文件编译后输出目录 -->
<jspDir>src\main\webapp</jspDir><!-- jsp 及资源文件存放目录 -->
<artifactDir>gfzq-khda</artifactDir> <!-- 项目名称,可以自定义 -->
<outputDir>C:/Users/Administrator.AEOFY-512152003/Desktop/系统更新包/maven</outputDir><!-- 补丁打包输出目标目录 -->
<outputClassDir>WEB-INF\classes</outputClassDir><!-- class文件拷贝的目标目录 -->
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format> <!-- 时间格式 -->
<aftertime>${maven.build.timestamp} 11:09:41"</aftertime><!-- 配置时间 -->
</properties>
一、配置属性
二、在<build>标签中加入下面的代码,可以根据自己需要进行修改
<pluginManagement><!-- 如果有,不用加-->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>package-patch</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="删除目录${outputDir}"></echo>
<delete dir="${outputDir}"/>
<echo message="新建目录${outputDir}"></echo>
<mkdir dir="${outputDir}"/>
<echo message="复制class文件、JSP文件,以及资源文件" />
<copy includeemptydirs="false" todir="${outputDir}/${artifactDir}/${outputClassDir}" preservelastmodified="true">
<fileset dir="${classesDir}">
<or>
<date when = "after" datetime = "${aftertime}" pattern="yyyy-MM-dd HH:mm:ss" />
<!-- <date when = "before" datetime = "${beforetime}" pattern="yyyy-MM-dd HH:mm:ss" />-->
</or>
</fileset>
</copy>
<copy includeemptydirs="false" todir="${outputDir}/${artifactDir}" preservelastmodified="true">
<fileset dir="${jspDir}">
<or>
<date when = "after" datetime = "${aftertime}" pattern="yyyy-MM-dd HH:mm:ss" />
<!-- <date when = "before" datetime = "${beforetime}" pattern="yyyy-MM-dd HH:mm:ss" />-->
</or>
</fileset>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
三、执行补丁打包命令
1、方式一:在DOS命令窗口,进入的项目的根目录,然后执行命令 mvn antrun:run@package-patch
注意:package-patch 为 execution 下的 id
2、方式二:在ECLIPSE/MYECLIPSE中,增设一个run,如下图
相关文章推荐
- Spring整合Mybatis使用<context:property-placeholder>时的坑
- Java基础之List--常用集合
- Java中的EL和JSTl
- java实现敏感词过滤
- mysql数据库数据改变监控 触发器 游标 new. old. java监控比对 最终是在后端java进行比对
- spring mvc 返回json数据的四种方式
- java 并发编程学习之一 ----synchronized
- Java中时分秒毫秒格式(xx:xx:xx.xxx)转换为整数(毫秒数)
- 待补充:java类里的私有变量问题,在对象A里有一个对象B,调用对象B的方法获取变量,会有短暂的缓存
- 【细说Java】揭开Java的main方法神秘的面纱(转)
- NamingException with message: Name [spring.liveBeansView.mbeanDomain]
- java反射机制
- java 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。
- Java Web中的EL(表达式语言)详解
- Eclipse无法启动报An internal error occurred during: "reload maven project". java.lang.NullPointerExceptio
- 解决方案java compiler level does not match the version of the installed java project facet
- spring整合mybatis使用<context:property-placeholder>时的坑
- java过滤器和监听器详解
- Java中整数(毫秒数)转换为时分秒毫秒格式(xx:xx:xx.xxx)
- 2016.6.24笔记(1)-本地配置2