2012-01-25 13 views
0

適切なリリースポリシーなしで、さまざまなサーバー環境で複数のjarファイルがリリースされている状況を管理する必要があります。リモートjarのマニフェスト情報を取得

これは、私が明示的にチェックしない限り、特定のサーバーでどのバージョンがリリースされたのかわかりません。

私はそのようなポリシーを適所に置くことを強いられていますが、それまでは私は暗闇の中にいます。

とにかく、いくつかの基本情報(タイムスタンプ、ビルドを実行するユーザー)の評価をビルドスクリプトに挿入することができました。そのため、状況を制御するための基本的なデータがあります。

私がしたいことは、その情報を読んで、全体的な状況を伝えるレポートを作成することです。

私は確かに2通りの方法でスクリプトを書くことができます: - 各サーバからjarファイルをダウンロードし、マニフェスト情報を抽出します。 - マニフェストを抽出して情報を返すリモートユーティリティを実行します。

このタスクを達成するためのツール/スクリプト/ ant-taskがありますか、それとも私自身で書くべきですか?

+0

私はantの既存の解決策に気づいていません。 – oers

答えて

1

あなたはどうにか各瓶の中に入る必要があります。それらの場所がすべて1つの場所(またはルートフォルダ)の下に展開されているとわかっている場合は、jarというgrepの組み合わせを使用するスクリプトを用意して、おそらくを見つけることができます。

for i in *.jar; do jar -tvf .... 

私は本当に別の方法を考えることはできません。

1

私はここで答えの一部が見つかりました:

Ant Task to read directly from a JAR Manifest file

<project> 

    <!-- Get a jar --> 
    <copy file="${ant.home}/lib/ant.jar" todir="."/> 

    <!-- 
    Loads entries from a manifest file. 
    @jar  The jar from where to read 
    @prefix A prefix to prepend 
    --> 
    <macrodef name="loadmf"> 
     <attribute name="jar"/> 
     <attribute name="prefix" default=""/> 
     <sequential> 
      <loadproperties> 
       <!-- Load the manifest entries --> 
       <zipentry zipfile="@{jar}" name="META-INF/MANIFEST.MF"/> 
       <!-- Add the prefix --> 
       <filterchain> 
        <prefixlines prefix="@{prefix}"/> 
       </filterchain> 
      </loadproperties> 
     </sequential> 
    </macrodef> 

    <!-- Read mf entries --> 
    <loadmf jar="ant.jar" prefix="ant-mf."/> 
    <!-- Print them --> 
    <echoproperties prefix="ant-mf."/> 

</project> 

それはかなりそれが言うことありません。これは私が私の仕事を成し遂げるために必要な基本的なものである

Buildfile: C:\dev\ant\build.xml 
    [copy] Copying 1 file to C:\dev\ant 
[echoproperties] #Ant properties 
[echoproperties] #Wed Jan 25 12:02:09 CET 2012 
[echoproperties] ant-mf.= 
[echoproperties] ant-mf.Ant-Version=Apache Ant 1.8.1 
[echoproperties] ant-mf.Created-By=1.5.0_22-b03 (Sun Microsystems Inc.) 
[echoproperties] ant-mf.Extension-name=org.apache.tools.ant 
[echoproperties] ant-mf.Implementation-Title=org.apache.tools.ant 
[echoproperties] ant-mf.Implementation-Vendor=Apache Software Foundation 
[echoproperties] ant-mf.Implementation-Version=1.8.1 
[echoproperties] ant-mf.Main-Class=org.apache.tools.ant.Main 
[echoproperties] ant-mf.Manifest-Version=1.0 
[echoproperties] ant-mf.Name=org/apache/tools/ant/ 
[echoproperties] ant-mf.Specification-Title=Apache Ant 
[echoproperties] ant-mf.Specification-Vendor=Apache Software Foundation 
[echoproperties] ant-mf.Specification-Version=1.8.1 

BUILD SUCCESSFUL 
Total time: 2 seconds 

出力は次のようなものです。

関連する問題