用Ant生成Jar文件時在manifest中加入定製格式的打包時間

說明

用tstamp和manifest可以實現這個功能。

<?xml version="1.0" encoding="UTF-8"?>  
  
<project name="AntTest" default="build" basedir=".">  
    <target name="build">  
  
        <!-- create timestamp with tstamp -->  
        <tstamp>  
            <format property="touch.time" pattern="yyyy/MM/dd hh:mm" />  
        </tstamp>  
        <echo message="${touch.time}" />  
  
          
        <jar destfile="test.jar" basedir="./target">  
            <include name="**/*.*" />  
              
            <!-- set mainfest information to manifest -->  
            <manifest>  
                <attribute name="Implementation-Maker" value="tian.yu" />  
                <attribute name="Implementation-Time" value="${touch.time}" />  
            </manifest>  
        </jar>  
    </target>  
</project>


原文鏈接地址:http://dncsoft.iteye.com/blog/324672

發佈了31 篇原創文章 · 獲贊 24 · 訪問量 84萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章