What is MOJO in Maven?

JavaMavenMaven PluginMojoAbbreviation

Java Problem Overview


I'm reading about Maven right now and everywhere in a text I see this word (mojo). I approximately understand what it means, but I would not refuse from a good explanation. I tried to google, but found only non-maven explanations.

POJO - ok, but MOJO? Maven Old Java Object?

Java Solutions


Solution 1 - Java

Yes, from http://maven.apache.org/plugin-developers/index.html:

What is a Mojo? A mojo is a Maven plain Old Java Object. Each mojo is an executable goal in Maven, and a plugin is a distribution of one or more related mojos.

In short, a mojo is a maven goal, to extend functionality not already found in maven.

Solution 2 - Java

As written here:

> A Maven Plugin is a Maven artifact which contains a plugin descriptor > and one or more Mojos. A Mojo can be thought of as a goal in Maven, > and every goal corresponds to a Mojo. The compiler:compile goal > corresponds to the CompilerMojo class in the Maven Compiler Plugin, > and the jar:jar goal corresponds to the JarMojo class in the Maven > Jar Plugin. When you write your own plugin, you are simply grouping > together a set of related Mojos (or goals) in a single plugin > artifact.

A Mojo simply associates with a Maven goal, so we can say a Mojo is much more than just a goal in Maven.

Solution 3 - Java

The Maven site says Mojo is the combination of "Maven" + "POJO (Plain Old Java Object)". So then, MOJO = Maven Old Java Object.

But another, different answer at Maven: The Complete Reference which I think is from the same group of people that are managing the Maven site suggest Mojo is meant to mean Magical POJO.

Solution 4 - Java

  • MOJO (Maven Old Java Object) is a goal in Maven.

  • In maven, everything is done by plugin, a plugin has one or more related mojos i.e. goals.

  • Mojo is single unit of task in maven.

for example : elicpse:eclipse the eclipse plugin with eclipse goal is a MOJO

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondnimView Question on Stackoverflow
Solution 1 - JavaLynn CrumblingView Answer on Stackoverflow
Solution 2 - JavaVenky VungaralaView Answer on Stackoverflow
Solution 3 - JavaJavateerView Answer on Stackoverflow
Solution 4 - JavaPremrajView Answer on Stackoverflow