Java – Getting Maven exec:java plugin to use project module dependencies


I'm using Maven's exec:java to run jline for one of my projects (current POM attached below). The project used to be a single component, so all dependencies were in the same POM as the exec:java plugin definition. This worked great and all the dependencies were picked up and put on the classpath when I ran 'mvn exec:java'. However, I've now split up the project into a few modules and would like the dependencies from each module to be picked up when exec:java is run, but I can't figure out how to configure it. Advice would be greatly appreciated!


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

Best Solution

You can specify a parent POM for the project and define the exec-plugin in the pluginManagement section of the parent. This means that the plugin configuration will be available to any child POM that declares a minimal plugin configuration. The following would be sufficient.


When the child is processed it will inherit the configuration from the parent, and the exec-plugin will be executed with the current project's dependencies.