How to prevent JavaExec task from copying jars

How do I prevent a task of type JavaExec, which is defined in a project that uses the war plugin, from copying jars from dependent projects’ into the project’s exploded war folder?

I have a war.finalizedBy explodedWar and explodedWar is of type Sync

I’m not sure how the JavaExec task knows where to copy the jars, since no dependencies are defined in the task. I noticed that it does have dependencies on classes and jar.

There’s something in your build that makes this happen. Perhaps that’s the behavior of your ‘explodedWar’ task, which your ‘JavaExec’ task somehow triggers (e.g. by depending on ‘war’).