Skip to content
The Mojo Executor provides a way to to execute other Mojos (plugins) within a Maven plugin, allowing you to easily create Maven plugins that are composed of other plugins.
Branch: master
Clone or download
Latest commit 9772e59 Apr 15, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
mojo-executor-maven-plugin [maven-release-plugin] prepare for next development iteration May 4, 2017

Build Status

The Mojo Executor provides a way to to execute other Mojos (plugins) within a Maven plugin, allowing you to easily create Maven plugins that are composed of other plugins.

Note from the Maintainer

I'm no longer maintaning this project actively, as I no longer use it (and have moved away from Maven and Java entirely). It's a simple library that does its job, and a lot of people are using it effectively in its current state.

I am happy to continue reviewing and merging pull requests, and releasing new versions to Maven Central. Most of the contributions so far have come from other people, and I'm very grateful to the people that have helped to improve Mojo Executor.

I do want to make it clear, however, that I won't be personally working on any bug reports or feature requests that come through the issue tracker without a pull request. I hope the community of Mojo Executor users will help answer questions and troubleshoot problems reported there.

If anyone in the community would like to take over as full-time maintainer, let's talk! Email me at and we can set up a Skype call or Google Hangout to discuss it in detail.

Cheers, — Tim


  • 4 May 2017 — Mojo Executor 2.3.0 released (by Nick Cross) with various bug fixes and minor improvements.
  • 27 Mar 2014 — Mojo Executor 1.5.2 released with support for Maven 2 through 3.1.
  • 12 Feb 2014 — I'm looking for a new maintainer for this project. If you're interested, please get in touch!
  • 26 Nov 2013 — Mojo Executor 2.2.0 released with support for attributes in plugin configuration.
  • 25 Aug 2013 — Mojo Executor 2.1.0 released with support for Maven 3.1.


You can download the jars, source, and javadocs from Maven central:

Example Usage

MojoExecutor defines a number of builder methods that are intended to be imported statically:

import static org.twdata.maven.mojoexecutor.MojoExecutor.*

This is how you would execute the "copy-dependencies" goal of the Maven Dependency Plugin programmatically:

        element(name("outputDirectory"), "${}/foo")

The project, session, and pluginManager variables should be injected via the normal Mojo injection:

private MavenProject mavenProject;

private MavenSession mavenSession;

private BuildPluginManager pluginManager;

An alternative form for the executionEnvironment, ignoring the optional MavenProject, is:


You might need to add other annotations to your Mojo class, depending on the needs of your plugin. Annotations declared by Mojos that you execute are not automatically inherited by your enclosing Mojo.

For example, if you are using the maven-dependency-plugin, as in this example, you will need to add @requiresDependencyResolution <scope> to your class annotations to ensure that Maven resolves the project dependencies before invoking your plugin.

See the Mojo API Specification for details on available annotations. Look at the included example plugin for an example of use.

Maven Dependency

Add this to your pom.xml:


There are a few versions available, and the best one to use will depend on the version(s) of Maven you need to support:

  • 1.0.1 — Supports Maven 2.x only
  • 1.5 — Supports both Maven 2.x and Maven 3.x
  • 2.0.x — Supports Maven 3.0.x only
  • 2.1.x — Supports Maven 3.0.x and 3.1.x


Copyright 2008-2013 Don Brown

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Mojo Executor was originally created by Don Brown (

It is currently maintained by Tim Moore (

Thanks to the following contributors, who have provided patches and other assistance:

You can’t perform that action at this time.