maven-anturn-plugin插件使用
来源:互联网 发布:php 500 error_log 编辑:程序博客网 时间:2024/05/19 20:19
maven-anturn-plugin插件为maven提供了ant功能,它可以使旧项目的配置操作在新项目得以重用。
该插件主要有2中执行ant操作的方法:
1.直接在插件中配置编写,例如:
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-antrun-plugin</artifactId><version>1.7</version><executions><execution><id>install</id><phase>install</phase><configuration><target><echo message="********************copy profile propertie file *************************" /><copy file="webContent/WEB-INF/temporary-lib/dhcc-user-bundle-1.0.7.jar"tofile="webContent/WEB-INF/lib/dhcc-user-bundle-1.0.7.jar"overwrite="true" /></target></configuration><goals><goal>run</goal></goals></execution></executions></plugin>上面的操作在项目编译的时候,复制了webContent/WEB-INF/temporary-lib/dhcc-user-bundle-1.0.7.jar文件到webContent/WEB-INF/lib/dhcc-user-bundle-1.0.7.jar。
2.调用ant脚本,即build.xml文件,并执行,例如:
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-antrun-plugin</artifactId><version>1.7</version><executions><execution><id>ant-magic</id><phase>prepare-package</phase><goals><goal>run</goal></goals><configuration><tasks><property name="compile_classpath" refid="maven.compile.classpath" /><!-- <property name="outputDir" value="${project.build.outputDirectory}"/> <property name="sourceDir" value="${project.build.sourceDirectory}" /> --><ant antfile="${basedir}/build.xml" target="prepare-package-clean" /></tasks></configuration></execution><execution><id>ant-magic2</id><phase>package</phase><goals><goal>run</goal></goals><configuration><tasks><property name="compile_classpath" refid="maven.compile.classpath" /><ant antfile="${basedir}/build.xml" target="package-clean" /></tasks></configuration></execution></executions></plugin>
build.xml
<?xml version="1.0" encoding="UTF-8"?><project default="prepare-package-clean" basedir="."><description>dhcc build file</description><property name="srcDir" location="src/main/java" /><property name="webDir" location="webContent" /><property name="lib.dir" location="${webDir}/WEB-INF/lib" /><property name="distDir" location="${webDir}" /><property name="dist.lib" location="${distDir}/WEB-INF/lib" /><property name="dist.classes" location="${distDir}/WEB-INF/classes" /><property name="targetDir" location="${distDir}/target" /><target name="prepare-package-clean"><echo message="clean lib jar and class start====" /><delete dir="${dist.classes}" /><delete dir="${dist.lib}\" /><echo message="clean lib jar and class end====" /></target><target name="package-clean"><echo message="clean jersey and jar and other jar start =====" /><delete file="${dist.lib}\jersey-core-1.17.1.jar" /><delete file="${dist.lib}\jersey-server-1.17.1.jar" /><delete file="${dist.lib}\jersey-servlet-1.17.1.jar" /><delete file="${dist.lib}\javassist-3.11.0.GA.jar" /><delete file="${dist.lib}\xml-apis-1.0.b2.jar" /><delete file="${dist.lib}\jackson-core-asl-1.9.11.jar" /><delete file="${dist.lib}\jackson-mapper-asl-1.9.11.jar" /><delete file="${dist.lib}\c3p0-0.9.1.1.jar" /><delete file="${dist.lib}\commons-fileupload-1.3.jar" /><delete file="${dist.lib}\jersey-core-1.18.jar" /><delete file="${dist.lib}\jersey-server-1.18.jar" /><delete file="${dist.lib}\jersey-servlet-1.18.jar" /><delete file="${dist.lib}\javassist-3.11.0.GA.jar" /><echo message="clean jersey and jar and other jar end =====" /></target><target name="init" depends="prepare-package-clean"><tstamp /><echo message="distDir ${distDir}" /><echo message="dist.classes dir ${dist.classes}" /><echo message="dist.lib ${dist.lib}" /></target><target name="compile" depends="init"><echo message="compile java ================== " /><echo message="dist.lib:${dist.lib}" /><mkdir dir="${dist.lib}" /><mkdir dir="${dist.classes}" /><javac encoding="utf-8" srcdir="${srcDir}" destdir="${dist.classes}" > <classpath refid="classpath"/></javac></target></project>
上面定义了2个节点(execution),分别在准备打包时执行prepare-package-clean任务,在打包的时候执行package-clean任务。
id:节点名
phase:任务执行时间,例如上面则是在执行maven package时运行任务
goal:只能为run,即运行时
configuration:任务配置
property:属性
echo:注释
ant:引入ant的脚本
0 0
- maven-anturn-plugin插件使用
- Tomcat-maven-plugin插件使用
- maven插件maven-dependency-plugin的使用
- maven插件maven-dependency-plugin的使用
- Maven使用tomcat8-maven-plugin插件
- Maven使用tomcat8-maven-plugin插件
- Maven使用tomcat8-maven-plugin插件
- 使用jetty-maven-plugin插件进行测试
- maven-dependency-plugin插件的使用
- maven-dependency-plugin插件的使用
- 使用jetty-maven-plugin插件进行测试
- maven-dependency-plugin插件的使用
- maven中tomcat7-maven-plugin插件的使用
- maven中tomcat7-maven-plugin插件的使用
- maven中tomcat7-maven-plugin插件的使用
- maven中tomcat7-maven-plugin插件的使用
- maven中tomcat7-maven-plugin插件的使用
- maven中tomcat7-maven-plugin插件的使用
- 关于如何使用websocket 接收并显示图片或者操作二进制
- ANdroid绘图之Canvas
- plsql development drop恢复
- 多渠道打包apk
- php学习_第一天
- maven-anturn-plugin插件使用
- Android BufferKnife使用时RecyclerView cannot be cast to android.widget.AdapterView
- 从DFSOutputStream的pipeline写机制到Streamer线程泄漏问题
- SQL 重置一个表
- unity shader 固定管线实例(六) 透明度测试剔除尖锐边缘的模糊处理
- linux下USB设备热插拔如何检测
- windows 下 #pragma的用途 简介
- PLSQL Developer报“动态执行表不可访问,本会话的自动统计被禁止”的解决方案
- Ad Network助力移动DSP突破数据孤岛困境