It's kind of humorous but I tried to add this as a comment to Tareq's excellent blog about Hello World with Spring Batch but go marked as a spammer. You can find his blog here: http://jroller.com/0xcafebabe/entry/spring_batch_hello_world_1. I hadn't noticed the little spam catcher with the addition problem and I guess I tried posting too many times. So I thought I'd blog about Spring Batch here and point back to Tareq's article, which I thought was about as simple a tutorial as I've seen for Spring Batch. I was working pretty closely with Lucas and Dave at writing a few sections of the Spring Batch Documentation and a lot of review before we pushed the release of 1.0. One of our big discussions was what to do with samples. It's currently a jira issue to do a better job organizing the samples and we've also discussed at some length about how to provide a simple way to launch. More than one person has commented about how they're all delivered as functional unit tests running with junit and sometimes people want to 1) see the samples running from the command line or 2) not be tied to eclipse to execute the samples. I thought Tareq's article did a great job of easing people into spring batch and thought I'd add a few comments.
I noticed a few questions from people wanting to run the example in Eclipse so I thought I'd add a little information for setting up Spring-Batch-Hello-World. I think some of the questions coming from above are due to unfamiliarity with maven. I happen to be very high on Maven but I understand that enthusiasm is not shared by all. So here's how to run the example in exclipse.
1. unzip the src jar into an eclipse workspace directory. I use my ~/workspace and unzipped with jar -xvf ~/Downloads/Spring-Batch-Hello-World1.jar.
2. cd into the directory and run mvn install eclipse:eclipse. You do need to install maven but it simplifies everything else. I'd bite the bullet and learn a little maven and in this case it makes the example much easier to understand.
3. Now start eclipse and import and existing project; ~/workspace/Spring-Batch-Hello-World. If you have not installed Maven before you'll need to go to preferences - Java -> Build Path -> Classpath Variables and add M2_REPO with the value of (for me) ~/.m2.repository. That should resolve all of the error messages.
One nice thing to notice is that because of the mvn setup (mvn install eclipse:eclipse) the Referenced Libraries in the classpath have all been setup. Now you can also see the where the source files (/src/main/java) and the resource files (/src/main/resources) are located in the Package Explorer.
4. Now setup a launch by opening Run -> Open Run Dialog and create a new Java Application. I named it Spring-Batch-Hello-World-Launch. On the Main tab make sure the project is Spring-Batch-Hello-World and make the main class org.springframework.batch.core.launch.support.CommandLineJobRunner/ . On the Arguments tab provide the simpleJob.xml simpleJob as Program arguments:. Now you can apply and Run. You should see the same output as running mvn exec with the only difference is that in the eclipse console the log messages are red and the Hello World! is black.
There's more to come as far as providing spring batch deployment models and we're also aware that its a big topic with a lot of options. I'll try and explore some deployment options shortly.
Hope that helps the newbies,
Wayne