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: org.springframework.batch.core.launch.support.CommandLineJobRunner
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)



Attachment(s):
RunDebug.png
0
1 comment

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

0

Please sign in to leave a comment.