300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > JAVA MAVEN POM.XML中关于ANT的配置

JAVA MAVEN POM.XML中关于ANT的配置

时间:2024-06-21 22:26:35

相关推荐

JAVA MAVEN POM.XML中关于ANT的配置

<properties> <!-- 文件拷贝时的编码 --> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <!-- 编译时的编码 --> <piler.encoding>UTF-8</piler.encoding> <projectDir>${basedir}</projectDir><!-- 项目目录 --><classesDir>target\classes</classesDir><!-- java 文件编译后输出目录 --><jspDir>src\main\webapp</jspDir><!-- jsp 及资源文件存放目录 --><artifactDir>gfzq-khda</artifactDir> <!-- 项目名称,可以自定义 --><outputDir>C:/Users/Administrator.AEOFY-51215/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,如下图

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。