Return-Path: Delivered-To: apmail-maven-commits-archive@www.apache.org Received: (qmail 72190 invoked from network); 14 Nov 2005 22:19:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Nov 2005 22:19:44 -0000 Received: (qmail 48950 invoked by uid 500); 14 Nov 2005 22:19:43 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 48903 invoked by uid 500); 14 Nov 2005 22:19:42 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 48892 invoked by uid 99); 14 Nov 2005 22:19:42 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 14 Nov 2005 14:19:41 -0800 Received: (qmail 72093 invoked by uid 65534); 14 Nov 2005 22:19:21 -0000 Message-ID: <20051114221921.72085.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r344250 - in /maven/site/trunk/src/site/apt/guides/introduction: introduction-to-plugin-prefix-mapping.apt introduction-to-plugin-resolution.apt Date: Mon, 14 Nov 2005 22:19:19 -0000 To: commits@maven.apache.org From: jdcasey@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: jdcasey Date: Mon Nov 14 14:19:14 2005 New Revision: 344250 URL: http://svn.apache.org/viewcvs?rev=344250&view=rev Log: Adding documentation on plugin resolution. Also, updated doco on plugin-prefix mapping. Added: maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-resolution.apt (with props) Modified: maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-prefix-mapping.apt Modified: maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-prefix-mapping.apt URL: http://svn.apache.org/viewcvs/maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-prefix-mapping.apt?rev=344250&r1=344249&r2=344250&view=diff ============================================================================== --- maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-prefix-mapping.apt (original) +++ maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-prefix-mapping.apt Mon Nov 14 14:19:14 2005 @@ -29,17 +29,28 @@ * Mapping Prefixes to Plugins - Quite simply, for each group of plugins in the Maven repository - (distinguished by a common groupId), there exists a metadata file called - <<>>. This file consists of the <> (for clarity when + For each groupId configured for searching, Maven will: + + [[1]] Download <<>> from each remote repository into the local repository, + and name it <<>> within the path of ${groupId}. + + [[2]] Load these metadata files, along with <<>> (if it exists), + within the path of ${groupId}. Merge them. + + [[3]] Lookup the plugin prefix in the merged metadata. If it's mapped, it should refer to + a concrete groupId-artifactId pair. Otherwise, go on to #1 for the next groupId in the + user's plugin-groups. + + [] + + These metadata files consist of the <> it represents (for clarity when the file is opened outside the context of the directory), and a group of <> elements. Each <> in this list contains a <> element denoting the plugin's command-line prefix, and an <> element, which provides the other side of the prefix mapping and provides enough information to lookup and use the plugin. When a plugin is installed - or deployed, this metadata file is resolved and if necessary, the prefix - mapping for the plugin is updated. In the case of deployment, this metadata - file is persisted to the remote repository. + or deployed, the appropriate metadata file is located - and if the prefix + mapping is missing - modified to include the plugin-prefix mapping. * Configuring Maven to Search for Plugins @@ -70,38 +81,16 @@ mvn -Dversion=4.0.0 -Dmodel=maven.mdo modello:java +---+ - Adding <> to the list of groupIds searched for plugin - prefixes will automatically import all of the modello maven plugins, but it - <> block the import of plugins from the <> - group - this plugin groupId is always the default, and cannot be suppressed. - -* Current Quirks - - The following list of items are on the table to be listed as bugs, and fixed. - They currently amount to quirks in the prefix resolution process. - - * The <> groupId is only used if <>. This means that I can - develop a third-party plugin that overloads the <<>> prefix, which - will drastically change the build behavior. Prefixes already mapped to the - <> groupId should <> be overridden, IMO. - - * <<>> metadata are resolved from the first repository possible, - rather than being merged. If two plugin repositories provide plugins in the - the same groupId, none but the plugins in the first repository can be - found using plugin-prefix resolution. IMO, this is by design and should not - change, particularly if we agree that a single project maintains control - over the groupId in question. - - <> One interesting side-effect of this is that snapshot-capable - repositories may have subtle interactions with "normal" repositories in this - respect (with one repository suppressing or being suppressed by the other, - but both serving the same project/groupId). - - * If you are testing a new plugin, and perform an install, the <<>> - for that plugin groupId will only be modified locally. If, at the next build, - you reference a plugin prefix that is not mapped in the local copy of any - configured plugin-prefix metadata, these metadata files will be re-resolved - from the remote repositories. This refresh step will erase the prefix mapping - for the locally installed plugin, erasing your ability to reference it without - configuring it explicitly in your <<>>. + Maven will always search the following groupId's <> searching any plugin groups + specified in the user's settings: + + * org.apache.maven.plugins + + * org.codehaus.mojo + + [] + + <> When specifying plugin groups to be used in searching for a prefix mapping, + order is critical! By specifying a pluginGroup of <<>> with a prefix + of <<>>, I can override the usage of the <<>> when + <<>> is invoked. Added: maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-resolution.apt URL: http://svn.apache.org/viewcvs/maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-resolution.apt?rev=344250&view=auto ============================================================================== --- maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-resolution.apt (added) +++ maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-resolution.apt Mon Nov 14 14:19:14 2005 @@ -0,0 +1,145 @@ + --- + Introduction to Maven Plugin Resolution + --- + John Casey + --- + 14-Nov-2005 + --- + +Introduction: How Maven Resolves Plugins + +*Introduction + + Starting with 2.0, Maven allows users to execute plugins that have not yet been installed. + This new feature eliminates the need to maintain local plugin installations, and + provides the implicit ability to instantly take advantage of new plugin releases. + However, it also means that plugin information must be resolved at build time, which + can be a complex task. + + This document will detail the mechanism used to resolve plugin information. + +*Referencing Plugins + + Maven 2.0 brings with it added flexibility for referencing plugins and their mojos. + Since plugin information is determined at build time, plugin prefixes can + be ambiguous, and dependent on an individual user's Maven configuration. Therefore, + in addition to the original mechanism of referencing a plugin by its shorthand prefix + and a goal, Maven can also process plugin and mojo references that concretely specify + groupId, artifactId, and optionally, version. + + Most users will have little difficulty using Maven as before, referencing plugins by + their prefix. However, with the introduction of the build lifecycle - and mojo bindings + to that lifecycle - it is critical that lifecycle mappings be able to refer to a mojo + in an unambiguous way. In fact, when dealing with lifecycle mappings, it's illegal to + specify a mojo using its plugin-prefix. This helps Maven avoid the case where the 'jar' + lifecycle behaves differently on two users' machines, simply due to their local Maven + configurations. As a side effect of this requirement, users also have the option to + specify plugins and mojos in this way from the command line. + + For clarity, the following are the three ways to reference a mojo from the command line. + These will all result in the clean mojo of the maven-clean-plugin being invoked: + ++---+ + mvn org.apache.maven.plugins:maven-clean-plugin:2.0:clean + mvn org.apache.maven.plugins:maven-clean-plugin:clean + mvn clean:clean ++---+ + + By contrast, only the following are valid mojo references from inside a lifecycle mapping + definition: + ++---+ + org.apache.maven.plugins:maven-clean-plugin:2.0:clean + org.apache.maven.plugins:maven-clean-plugin:clean ++---+ + + <> It's probably bad form to pin a plugin reference to a specific version inside + a lifecycle mapping definition, since this prevents the user from taking advantage of + plugin updates. + +*Resolving Plugin Information + + Since users have the ability to reference a plugin by its groupId and artifactId <> + a version, Maven must have the ability to resolve the plugin's version given these other + two attributes. However, since users can also refer to a plugin by its prefix, Maven must + also have the ability to resolve a plugin by this prefix alone - including resolution of + the plugin's version. To handle these two scenarios, Maven employs a two-stage process for + resolving plugin information. + +**Resolving <<>> and <<>> for a Plugin + + Maven's approach to resolving a plugin's groupId and artifactId given its prefix is actually + relatively simple. The user can specify a set of plugin groupId's to be searched. Using + repository metadata for each configured groupId, Maven will search for plugin prefix mappings + using the process detailed in \[{{{#1}1}}\]. + +**Resolving a Plugin's Version + + When a plugin's groupId and artifactId are known, but its version is still unknown, + Maven will resolve that plugin's version using a variety of sources. It will check, + in order, the following: + + [[1]] + + This includes all plugins specified in the \ section; this is intuitive. + However, since all plugin specifications in the POM are still generally a better + source of information than reverting to external sources, < + section will also be searched.>> + + <> Checking of the \ section is new for Maven 2.0.1. + + [[2]] + + This configuration file, usually located in <<>> within the + $HOME/.m2 directory, is disabled by default. To enable it, add the following + section to the <<>> file (also within $HOME/.m2): + ++---+ + + ... + true + ... + ++---+ + + The plugin registry will maintain a mapping of {groupId, artifactId} for a plugin + to the version to be used. It will also maintain a record of the last time the + plugin was checked for updated versions; the configuration for when to check + for updated versions; and a list of rejected versions of the plugin which are not + to be used. If an updated version is found which has not yet been rejected, the + plugin version manager will ask the user whether to use this version. The user + can reject the version for now or always, or accept it for now or always. If + prompting is disabled (batch mode), the plugin registry can be configured with + a default answer to this question. + + See \[{{{#2}2}}\] for more information on the plugin registry. + + [[3]] + + This is published each time a Maven plugin is deployed or installed. It is simply + a pointer to the latest published version of the plugin. It differs from the + SNAPSHOT metadata in that it is always present, regardless of the project's version. + + If you use the plugin registry, you can disable this check. + + [[4]] + + Since the LATEST metadata is always published, it obsoletes this check when #3 is + enabled. However, RELEASE metadata checking is still important in order to support + legacy plugin-releases, where the LATEST metadata has not been published. This check + can also be useful if the LATEST metadata check has been disabled. This might be used + instead of LATEST metadata if the user only wants to use supported, released plugin + versions. + + [] + + If all of the above resolution methods fail, the plugin cannot be located and an exception + is thrown, stopping the build. + +*Resources + + [[{1}]] {{{./introduction-to-plugin-prefix-mapping.html}Introduction to the Plugin Prefix Mapping}}. + + [[{2}]] {{{./introduction-to-plugin-registry.html}Introduction to the Plugin Registry}}. + + [] Propchange: maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-resolution.apt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/site/trunk/src/site/apt/guides/introduction/introduction-to-plugin-resolution.apt ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"