Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between maven-archetype-mojo and maven-archetype-plugin?

Snippet from the output of running the command mvn archetype:generate > a.txt:

332: remote -> org.apache.maven.archetypes:maven-archetype-mojo (An archetype which contains a sample a sample Maven plugin.)
333: remote -> org.apache.maven.archetypes:maven-archetype-plugin (An archetype which contains a sample Maven plugin.)

Running the following commands generated near-identical pom files and Java source classes:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app-plugin -DarchetypeArtifactId=maven-archetype-plugin -DinteractiveMode=false

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app-mojo -DarchetypeArtifactId=maven-archetype-mojo -DinteractiveMode=false

So what is the difference between maven-archetype-mojo and maven-archetype-plugin? Will either of these generate a sample plugin project? Why do we have both?

like image 566
crnlx Avatar asked Jan 21 '14 19:01

crnlx


People also ask

What is Maven archetype plugin?

The Archetype Plugin allows the user to create a Maven project from an existing template called an archetype. It also allows the user to create an archetype from an existing project. This plugin requires Java 7.

What are the different Maven archetypes?

An archetype to generate a simplifed sample J2EE application. An archetype to generate a sample a sample Maven plugin. An archetype to generate a sample Maven plugin. An archetype to generate a sample Maven plugin site.

What archetype should I choose for Maven project?

maven-archetype-quickstart is an archetype which generates a sample Maven project: project. |-- pom. xml.

What are the types of Maven plugins?

Introduction. In Maven, there are two kinds of plugins, build and reporting: Build plugins are executed during the build and configured in the <build/> element. Reporting plugins are executed during the site generation and configured in the <reporting/> element.


1 Answers

There is no difference. Maven Mojo is a minimal Maven Plugin.

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.

I think we does not need both, just some mess in Maven world :)

like image 94
MariuszS Avatar answered Oct 14 '22 18:10

MariuszS