用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万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章