To execute a single Maven plugin goal, we used the syntax mvn archetype:generate, where
archetype is the identifier of a plugin and generate is the identifier of a goal.
The core of Maven has little to do with the specific tasks involved in your project’s build. By itself, Maven
doesn’t know how to compile your code or even how to make a JAR file. It delegates all of this work to
Maven plugins like the Compiler plugin and the Jar plugin, which are downloaded on an as-needed basis
and periodically updated from the central Maven repository. When you download Maven, you are getting
the core of Maven, which consists of a very basic shell that knows only how to parse the command line,
manage a classpath, parse a POM file, and download Maven plugins as needed. By keeping the Compiler
plugin separate from Maven’s core and providing for an update mechanism, Maven makes it easier for
users to have access to the latest options in the compiler. In this way, Maven plugins allow for universal
reusability of common build logic. You are not defining the compile task in a build file; you are using
a Compiler plugin that is shared by every user of Maven. If there is an improvement to the Compiler
plugin, every project that uses Maven can immediately benefit from this change. (And, if you don’t like
the Compiler plugin, you can override it with your own implementation.)
No comments:
Post a Comment