I'm reading a spring batch book and making the examples that show because I will start to work with java and spring batch the next month(now I use c#), one example uses ParameterValidator
to validate receiving one parameter name
so the maven test
will work only if the parameter it was past,
public class ParameterValidator implements JobParametersValidator {
@Override
public void validate(JobParameters parameters) throws JobParametersInvalidException {
String fileName = parameters.getString("fileName");
if(!StringUtils.hasText(fileName)) {
throw new JobParametersInvalidException("fileName missing");
}
else if(!StringUtils.endsWithIgnoreCase(fileName, "csv")) {
throw new JobParametersInvalidException("fileName parameter does " +
"not use the csv file extension");
}
}
I tried passing the data using arguments tag in pom.xml
:
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<arguments> fileName=foo.csv</arguments>
</configuration>
</plugin>
</plugins>
, editing the test:
and try other answers I found on internet but always raise the error of missing parameter.
Is it possible to pass arguments using this IDE and maven
?
Thanks!