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

1 篇文章 0 订阅

  <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,如下图


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值