Search code examples
javaspringmavenspring-batch

When running spring batch from maven, how do you set job parameters?


Lets say you run a spring batch program from maven:

mvn spring-boot:run -Dspring.batch.job.names=MyJobNameHere

What if I want to send job parameters? How would I accomplish that?


Solution

  • From this answer, I found you can send parameters into a spring boot application using

    -Drun.arguments="param1=value1,param2=value2"
    

    Example:

    mvn spring-boot:run -Dspring.batch.job.names=jobNameHere -Drun.arguments="arg=val,arg2=val2" -f pom.xml
    

    When running a Spring Batch, that same technique seems to work.