Spring framewrok Batch の Example を見てみよう

はじめに

spring framework を使ってみようということで
http://www.springsource.org/downloads/sts-ggts
で配布されている、 Eclipse 込みの、all-in-one distribution を
download-install-open してみました

興味のある Spring Batch の Project を Eclipse の New Project、
Spring Template Project で作り、
そのソースを見ようとしたんですが
Eclipse が落ちて見れませんでした

多分Junoが悪いと決め付けて
Indigo を落とし、そちらへ、 Spring tool suite を入れてみることにしました

WinXP 32bit 上で行っています。

eclipse indigo インストール

Eclipse Indigo Sr2 Packages の Windows 32-bit を download-install
http://www.eclipse.org/downloads/packages/release/indigo/sr2

spring tool suite インストール

http://www.springsource.org/STS-installation-instructions

のたまわく、「installはマーケットプレースが楽チンだぜ」なので
そうしました

引用:

Install via Eclipse Marketplace

Probably the easiest way to get the Spring and/or the Groovy/Grails tooling installed into an existing
Eclipse installation is to use the Eclipse Marketplace Client. Open that Marketplace Client and search for
“Spring Tool Suite” or “Groovy/Grails Tool Suite” (“tool suite”, “sts”, and “ggts” also work nicely as search
strings).

Choose the right item for your Eclipse platform, press “Install” and you are done.

Help > Eclipse Marketplace.. を開きます
Find に “Spring Tool Suite” と入力し検索します
Spring Tool Suite (STS) for Eclipse Indigo (3.7)
が見つかると思います
Install を押します

f:id:quwahara:20121007113331p:plain

Install、再起動し Eclipse を開きます
File > New > Project... を開きます
Spring > Spring Template Project を開きます

f:id:quwahara:20121007114205p:plain

Batch > Simple Spring Batch Project を選び、 Next を押します

f:id:quwahara:20121007114328p:plain

じゃんじゃんdownloadしてもらいます

f:id:quwahara:20121007114429p:plain

スクリーンショット撮る前に Next を押しちゃったんで
入力できない風の画面になってますが
必要事項を入力します

最下段の package 名は a.b.c 形式でないとダメみたい

f:id:quwahara:20121007115030p:plain

(your project name) > src/main/java > (your.package.name) > ExampleItemReader.java

とか開くと "Hello world!" とかあるので、お手本感を味わえます

f:id:quwahara:20121007115457p:plain


おしまい (´-`)

追伸 (10/07)

上記手順をすると error が出るがとれません...

f:id:quwahara:20121008200445p:plain

Description Resource Path Location Type
Archive for required library: 'C:/Documents and Settings/user1/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar' in project 'b' cannot be read or is not a valid ZIP file b Build path Build Path Problem

追伸2 (10/07)

これを
http://mirrors.ibiblio.org/maven2/log4j/log4j/1.2.14/

log4j-1.2.14.jar.sha1
log4j-1.2.14.jar

ここに上書きし
C:\Documents and Settings\\.m2\repository\log4j\log4j\1.2.14

Project > Clean ... > [o] Clean all projects > OK
したら、エラーが消えました


いいのかこれで?!