Forums: Open Discussion (Thread #23759)

【バッチFW】jarやMANIFEST.MF作成方法 (2009-08-28 16:20 by Anonymous #45612)

お世話になってます。

素人な質問にはなってしまいますが、terasolunaバッチで作成したプロジェクトをjarで固めて
サーバーで実行したいと思っています。

具体的にどのように、jarを作成すればいいのでしょうか。

FWを使用していないプロジェクト等であれば、Eclipseの機能でプロジェクトごと、jarにすればいいと思うのですが、、

また、バッチFWでのMANIFEST.MFの設定を教えて頂けると助かります。。

お手数ではありますが、出来れば素人にもわかり易い様、詳細にご教授お願いできないでしょう。

※特にmainの処理のJobStart.javaや引数の渡し方などを詳しく書いていただけると助かります。


Reply to #45612×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 【バッチFW】jarやMANIFEST.MF作成方法 (2009-09-01 20:42 by sugimotoku #45662)

以下、tutorial-batchプロジェクトを例にご説明させて頂きます。

1)jarファイルの作成方法
----- tutorial-batch/ant/build.xml を以下のような内容を追加 ----
<target name="createJar" description="jarファイル生成" depends="compile">
<delete dir="./dist" failonerror="false" />
<mkdir dir="./dist" />
<manifest file="./dist/MANIFEST.MF">
<attribute name="Main-Class" value="jp.terasoluna.fw.batch.springsupport.init.JobStarter" />
<attribute name="Class-Path" value="${lib.dir}/commons-beanutils-1.7.0.jar
${lib.dir}/commons-collections-3.2.jar
${lib.dir}/commons-dbcp-1.2.2.jar
${lib.dir}/commons-digester-1.8.jar
${lib.dir}/commons-jxpath-1.2.jar
${lib.dir}/commons-lang-2.3.jar
${lib.dir}/commons-logging-1.1.jar
${lib.dir}/commons-pool-1.3.jar
${lib.dir}/commons-validator-1.3.1.jar
${lib.dir}/hsqldb.jar
${lib.dir}/ibatis-2.3.0.677.jar
${lib.dir}/jakarta-oro-2.0.8.jar
${lib.dir}/log4j-1.2.14.jar
${lib.dir}/spring.jar
${lib.dir}/spring-modules-validation.jar
${lib.dir}/terasoluna-batch.jar" />
</manifest>
<jar destfile="./dist/${ant.project.name}.jar" manifest="./dist/MANIFEST.MF" basedir="./classes" />
</target>
----
Eclipseを利用し、このbuild.xmlのcreateJarターゲットを指定して
[tutorial-batch.jar]を作成します。
ご質問のMANIFEST.MFについては”Main-Class”と”Class-Path”を追加する設定を
しておりますが、ご利用の環境にあわせて編集してください。
(例えば、スクリプトやバッチファイルによってjavaコマンドでメインクラスや
 クラスパスを指定する場合は、manifestタグとjarタグのmanifest属性は不要です)
※antの各タグについては[http://ant.apache.org/manual/index.html]を参照ください。


2)tutorial-batch.jarに含まれるジョブの実行方法
コマンドプロンプトから以下のコマンドを実行することでtutorial-batchプロジェクトの
ジョブ”JB0001”を実行できます。
---- コマンドプロンプト(Windowsの場合) ----
> cd /d [tutorial-batchプロジェクトのフルパス]
> java -jar tutorial-batch.jar JB0001 /tutorial/UC0001/JB0001.xml
----
ジョブに引数がある場合は”/tutorial/UC0001/JB0001.xml”に続けてジョブ固有の
引数を記述します。
ジョブの引数についての詳細は「TERASOLUNA Batch Framework for Java 機能説明書.pdf」の
「BE-01 同期型ジョブ起動機能」にあります「ジョブ起動時の引数」を参照ください。
Reply to #45612

Reply to #45662×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 【バッチFW】jarやMANIFEST.MF作成方法 (2009-09-02 16:55 by Anonymous #45672)

ありがとうございます。

お蔭様で、解決する事ができました!!
m(_ _)m
Reply to #45612

Reply to #45672×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login