Java Reference
In-Depth Information
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<index>false</index>
<manifest>
<mainClass>
org.springframework.batch.core.launch.support.CommandLineJobRunner
</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestFile>${project.build.outputDirectory}/META-
INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
To build your artifacts, you use the standard mvn clean install command for the main jar file
because the batch profile has been configured to be active by default. To build the slave jar file, invoke
the listener profile using the mvn clean install -P listener command. In order for the listener profile
to work, however, you need to write the Geocoder class; see Listing 11-26.
Listing 11-26. Geocoder
package com.apress.springbatch.chapter11.main;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Geocoder {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
new ClassPathXmlApplicationContext("/jobs/geocodeJob.xml");
System.in.read();
}
}
As you can see in Listing 11-26, all the Geocoder class does is load your context and block by calling
System.in.read() . This keeps the application up and running until you decide to kill it. Because you can
build your two jar files at this point, let's look at what it takes to add remote chunking to the application.
 
Search WWH ::




Custom Search