Problems debugging Spring Batch jobs - forced to invalidate caches

I'm having major issues trying to debug Spring Batch jobs with IntelliJ. The approach I'm using fails consistently in a repeatable fashion. My test scenario is pretty complicated and I doubt I can really provide a test project to illustrate the behavior. I'm able to debug my batch job from a Run/Debug configuration using the CommandLineJobLauncher but once I do a maven clean/install on my module the Run/Debug configuration generates the error below until I invalidate caches. Once I invalidate caches the Run/Debug configuration is usable again until I do a mvn clean/install again. Obviouly invalidating caches is an expensive operation so this is not ideal. Can somebody suggest a course of action? The attached file shows my Run/Debug configuration.

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/batch/core/launch/support/CommandLineJobRunner
Caused by: java.lang.ClassNotFoundException:
 at Method)
 at java.lang.ClassLoader.loadClass(
 at sun.misc.Launcher$AppClassLoader.loadClass(
 at java.lang.ClassLoader.loadClass(

1 comment

I may have finally figured this one out. When I changed dependency scope from Test to Compile it worked fine.


Please sign in to leave a comment.