I am trying to run a spring batch job from a spring boot fat jar and I am having issues referencing the nested jars.
Here is the command I use:
java -cp bignibou-batch-core/build/libs/bignibou-batch-core.jar:lib/spring-batch-core-3.0.3.RELEASE.jar org.springframework.batch.core.launch.support.CommandLineJobRunner com.bignibou.batch.configuration.BatchConfiguration mailingJob
Notice how I reference the nested spring batch jar using the colon. Why is this not working?
It says it cannot find the main class:
Erreur : impossible de trouver ou charger la classe principale org.springframework.batch.core.launch.support.CommandLineJobRunner
I turns out that there is a nice option to choose one job (out of multiple jobs) from within a fat jar:
Only
jobOne
&jobThree
will run even ifjobTwo
also exists.See http://docs.spring.io/spring-boot/docs/current/reference/html/howto-batch-applications.html for documentation.
So as far as I am concerned, this sorted my problem: