As you have already seen, it is possible to execute plugins directly from the command line without configuring the plugin in the project POM file.
To find out which plugin you want to execute, maven uses plugin prefix permission.
Using your mvn checkstyle:checkstyle command line mvn checkstyle:checkstyle , as an example, this is roughly what maven does:
- take the prefix, the bit before the colon, from the execution. In your case,
checkstyle . - allow this possible name (artifactId) of the plugin. To do this, it uses two possible formats:
maven-${prefix}-plugin (for official Maven plugins)${prefix}-maven-plugin (for plugins from other sources)
- now it has
maven-checkstyle-plugin as artifactId plugin - find the plugin with this artifactId and one of the configured groupIds ids (by default, maven searches with groupId
org.apache.maven.plugins ) - he finds maven-checkstyle-plugin
- fulfills the goal (the bit after the colon in the command), so the goal of the click in this case.
All this is explained in much more detail and better than I can on the prefix prefix page of the maven official documentation plugin .
source share