Fork me on GitHub

Using Executable Binary Dependencies Instead of Local Executables

Instead of invoking a locally installed binary executable (identified by executable), a dependency (identified by executableDependency) can directly get executed instead. This particularly is useful when the dependency is an executable binary like .exe or .bat file produced by a different Maven project which got deployed into a repository. The binary gets pulled to the local repository and is getting executed right there without the need to know its actual file name or location on disk: Just the GA coordinates (groupId, artifactId) are needed. Hence the executable parameter has to be omitted in favor of the executableDependency parameter.

There are two ways of using executable binary dependencies: Project dependencies and plugin dependencies. Currently the exec goal only supports plugin dependencies.

Plugin Dependencies

Plugin Dependencies are referenced from within the plugin configuration.

pom.xml

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        ...
        <configuration>
          <executableDependency>
            <!-- REFERENCES plugin dependency, see declaration below -->
            <groupId>your-group</groupId>
            <artifactId>your-artifact</artifactId>
          </executableDependency>
        </configuration>
        <dependencies>
          <dependency>
            <!-- DECLARES plugin dependency, see reference above -->
            <groupId>your-group</groupId>
            <artifactId>your-artifact</artifactId>
            <type>exe</type>
            <version>your-version</version>
          </dependency>
        </dependencies>    
        ...
      </plugin>
    </plugins>
  </build>
  ...
</project>