Author: brett
Date: Tue Jul 26 02:04:32 2005
New Revision: 225263
URL: http://svn.apache.org/viewcvs?rev=225263&view=rev
Log:
PR: MNG-598
implement ability to retrieve packaging handlers (lifecycle mappings) from
extension plugins. Remove plugin mapping
metadata for the same
integration tests are in place for type handlers but commented out until
implemented (41)
Added:
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
(with props)
maven/components/trunk/maven-core-it-plugin/src/main/resources/META-INF/plexus/
maven/components/trunk/maven-core-it-plugin/src/main/resources/META-INF/plexus/components.xml
(with props)
maven/components/trunk/maven-core-it-support/1.2/
- copied from r225236, maven/components/trunk/maven-core-it-support/1.1/
maven/components/trunk/maven-core-it/it0040/ (with props)
maven/components/trunk/maven-core-it/it0040/expected-results.txt (with
props)
maven/components/trunk/maven-core-it/it0040/goals.txt (with props)
maven/components/trunk/maven-core-it/it0040/pom.xml (with props)
maven/components/trunk/maven-core-it/it0041/ (with props)
maven/components/trunk/maven-core-it/it0041/expected-results.txt (with
props)
maven/components/trunk/maven-core-it/it0041/goals.txt (with props)
maven/components/trunk/maven-core-it/it0041/pom.xml (with props)
maven/components/trunk/maven-core-it/it1009/
maven/components/trunk/maven-core-it/it1009/goals.txt (with props)
maven/components/trunk/maven-core-it/it1009/pom.xml (with props)
maven/components/trunk/maven-core-it/it1010/
maven/components/trunk/maven-core-it/it1010/goals.txt (with props)
maven/components/trunk/maven-core-it/it1010/pom.xml (with props)
Modified:
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java
maven/components/trunk/maven-core-it-plugin/pom.xml
maven/components/trunk/maven-core-it-support/1.2/pom.xml
maven/components/trunk/maven-core-it/README.txt
maven/components/trunk/maven-core-it/integration-tests.txt
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
maven/components/trunk/maven-model/maven.mdo
maven/components/trunk/maven-plugin-mapping/src/main/java/org/apache/maven/plugin/mapping/PluginMappingManager.java
maven/components/trunk/maven-plugin-mapping/src/main/mdo/plugins.mdo
maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AbstractPluginMappingMojo.java
Modified:
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
---
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java
(original)
+++
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/handler/ArtifactHandler.java
Tue Jul 26 02:04:32 2005
@@ -22,7 +22,7 @@
*/
public interface ArtifactHandler
{
- static String ROLE = ArtifactHandler.class.getName();
+ String ROLE = ArtifactHandler.class.getName();
String getExtension();
Modified: maven/components/trunk/maven-core-it-plugin/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-plugin/pom.xml?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it-plugin/pom.xml (original)
+++ maven/components/trunk/maven-core-it-plugin/pom.xml Tue Jul 26 02:04:32 2005
@@ -23,6 +23,11 @@
<version>2.0-beta-1-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.0-beta-1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>0.9.1</version>
Added:
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java?rev=225263&view=auto
==============================================================================
---
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
(added)
+++
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
Tue Jul 26 02:04:32 2005
@@ -0,0 +1,75 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+
+/**
+ * @author <a href="[EMAIL PROTECTED]">Brett Porter</a>
+ * @version $Id$
+ * @goal package
+ */
+public class PackagingMojo
+ extends AbstractMojo
+{
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression="${project.build.finalName}"
+ * @required
+ */
+ private String finalName;
+
+ /**
+ * @parameter expression="${project.build.directory}"
+ * @required
+ * @readonly
+ */
+ private String outputDirectory;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ File jarFile = new File( outputDirectory, finalName + "-it.jar" );
+
+ MavenArchiver archiver = new MavenArchiver();
+
+ archiver.setOutputFile( jarFile );
+
+ try
+ {
+ archiver.createArchive( project, new MavenArchiveConfiguration() );
+ }
+ catch ( Exception e )
+ {
+ // TODO: improve error handling
+ throw new MojoExecutionException( "Error assembling JAR", e );
+ }
+ }
+
+}
Propchange:
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/components/trunk/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/components/trunk/maven-core-it-plugin/src/main/resources/META-INF/plexus/components.xml
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-plugin/src/main/resources/META-INF/plexus/components.xml?rev=225263&view=auto
==============================================================================
---
maven/components/trunk/maven-core-it-plugin/src/main/resources/META-INF/plexus/components.xml
(added)
+++
maven/components/trunk/maven-core-it-plugin/src/main/resources/META-INF/plexus/components.xml
Tue Jul 26 02:04:32 2005
@@ -0,0 +1,29 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>coreit-packaging</role-hint>
+
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <!-- START SNIPPET: plexus-application-lifecycle -->
+ <phases>
+ <package>core-it:package</package>
+ <install>install:install</install>
+ <deploy>deploy:deploy</deploy>
+ </phases>
+ <!-- END SNIPPET: plexus-application-lifecycle -->
+ </configuration>
+ </component>
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>coreit-artifact</role-hint>
+
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <type>coreit-artifact</type>
+ <extension>jar</extension>
+ <packaginge>coreit-packaging</packaginge>
+ <classifier>it</classifier>
+ </configuration>
+ </component>
+ </components>
+</component-set>
Propchange:
maven/components/trunk/maven-core-it-plugin/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/components/trunk/maven-core-it-plugin/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/components/trunk/maven-core-it-support/1.2/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-support/1.2/pom.xml?rev=225263&r1=225236&r2=225263&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it-support/1.2/pom.xml (original)
+++ maven/components/trunk/maven-core-it-support/1.2/pom.xml Tue Jul 26
02:04:32 2005
@@ -3,8 +3,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core-it-support</artifactId>
- <packaging>jar</packaging>
- <version>1.1</version>
+ <packaging>coreit-packaging</packaging>
+ <version>1.2</version>
<distributionManagement>
<repository>
<id>repo1</id>
@@ -12,4 +12,14 @@
<url>scp://repo1.maven.org/home/projects/maven/repository-staging/to-ibiblio/maven2</url>
</repository>
</distributionManagement>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-core-it-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
</model>
Modified: maven/components/trunk/maven-core-it/README.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/README.txt?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/README.txt (original)
+++ maven/components/trunk/maven-core-it/README.txt Tue Jul 26 02:04:32 2005
@@ -116,6 +116,10 @@
pom.xml. The release-pom.xml file should be chosen above pom.xml for
these projects in the build.
+it0040: Test the use of a packaging from a plugin
+
+it0041: Test the use of a new type from a plugin
+
-------------------------------------------------------------------------------
- generated sources
@@ -165,5 +169,9 @@
-------------------------------------------------------------------------------
it1008: Should fail due to requiring a version range for junit that doesn't
exist
in the repository. Currently succeeds (MNG-614)
+-------------------------------------------------------------------------------
+it1009: Tests packaging from a plugin fails when extensions is not true.
+-------------------------------------------------------------------------------
+it1010: Tests a type from a plugin fails when extensions is not true.
-------------------------------------------------------------------------------
Modified: maven/components/trunk/maven-core-it/integration-tests.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/integration-tests.txt?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/integration-tests.txt (original)
+++ maven/components/trunk/maven-core-it/integration-tests.txt Tue Jul 26
02:04:32 2005
@@ -1,3 +1,5 @@
+#it0041
+it0040
it0039
it0038
it0037
Propchange: maven/components/trunk/maven-core-it/it0040/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jul 26 02:04:32 2005
@@ -0,0 +1,2 @@
+log.txt
+target
Added: maven/components/trunk/maven-core-it/it0040/expected-results.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0040/expected-results.txt?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0040/expected-results.txt (added)
+++ maven/components/trunk/maven-core-it/it0040/expected-results.txt Tue Jul 26
02:04:32 2005
@@ -0,0 +1 @@
+target/maven-core-it0040-1.0-it.jar
Propchange: maven/components/trunk/maven-core-it/it0040/expected-results.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it0040/expected-results.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it0040/goals.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0040/goals.txt?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0040/goals.txt (added)
+++ maven/components/trunk/maven-core-it/it0040/goals.txt Tue Jul 26 02:04:32
2005
@@ -0,0 +1 @@
+package
Propchange: maven/components/trunk/maven-core-it/it0040/goals.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it0040/goals.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it0040/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0040/pom.xml?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0040/pom.xml (added)
+++ maven/components/trunk/maven-core-it/it0040/pom.xml Tue Jul 26 02:04:32 2005
@@ -0,0 +1,17 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core-it0040</artifactId>
+ <packaging>coreit-packaging</packaging>
+ <version>1.0</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-core-it-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/components/trunk/maven-core-it/it0040/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it0040/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/components/trunk/maven-core-it/it0041/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Jul 26 02:04:32 2005
@@ -0,0 +1,2 @@
+log.txt
+target
Added: maven/components/trunk/maven-core-it/it0041/expected-results.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0041/expected-results.txt?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0041/expected-results.txt (added)
+++ maven/components/trunk/maven-core-it/it0041/expected-results.txt Tue Jul 26
02:04:32 2005
@@ -0,0 +1 @@
+target/maven-core-it0036-1.0.jar
Propchange: maven/components/trunk/maven-core-it/it0041/expected-results.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it0041/expected-results.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it0041/goals.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0041/goals.txt?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0041/goals.txt (added)
+++ maven/components/trunk/maven-core-it/it0041/goals.txt Tue Jul 26 02:04:32
2005
@@ -0,0 +1 @@
+package
Propchange: maven/components/trunk/maven-core-it/it0041/goals.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it0041/goals.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it0041/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0041/pom.xml?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it0041/pom.xml (added)
+++ maven/components/trunk/maven-core-it/it0041/pom.xml Tue Jul 26 02:04:32 2005
@@ -0,0 +1,24 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core-it0041</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core-it-support</artifactId>
+ <version>1.2</version>
+ <type>coreit-artifact</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-core-it-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/components/trunk/maven-core-it/it0041/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it0041/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it1009/goals.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it1009/goals.txt?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it1009/goals.txt (added)
+++ maven/components/trunk/maven-core-it/it1009/goals.txt Tue Jul 26 02:04:32
2005
@@ -0,0 +1 @@
+package
Propchange: maven/components/trunk/maven-core-it/it1009/goals.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it1009/goals.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it1009/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it1009/pom.xml?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it1009/pom.xml (added)
+++ maven/components/trunk/maven-core-it/it1009/pom.xml Tue Jul 26 02:04:32 2005
@@ -0,0 +1,16 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core-it1009</artifactId>
+ <packaging>coreit-packaging</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-core-it-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/components/trunk/maven-core-it/it1009/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it1009/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it1010/goals.txt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it1010/goals.txt?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it1010/goals.txt (added)
+++ maven/components/trunk/maven-core-it/it1010/goals.txt Tue Jul 26 02:04:32
2005
@@ -0,0 +1 @@
+package
Propchange: maven/components/trunk/maven-core-it/it1010/goals.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it1010/goals.txt
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core-it/it1010/pom.xml
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it1010/pom.xml?rev=225263&view=auto
==============================================================================
--- maven/components/trunk/maven-core-it/it1010/pom.xml (added)
+++ maven/components/trunk/maven-core-it/it1010/pom.xml Tue Jul 26 02:04:32 2005
@@ -0,0 +1,23 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core-it1010</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core-it-support</artifactId>
+ <version>1.2</version>
+ <type>coreit-artifact</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-core-it-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/components/trunk/maven-core-it/it1010/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core-it/it1010/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
(original)
+++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Tue Jul 26 02:04:32 2005
@@ -17,7 +17,6 @@
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
-import
org.apache.maven.artifact.repository.metadata.RepositoryMetadataManagementException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.execution.MavenExecutionResponse;
import org.apache.maven.execution.MavenSession;
@@ -37,8 +36,6 @@
import org.apache.maven.plugin.lifecycle.Lifecycle;
import org.apache.maven.plugin.lifecycle.Phase;
import org.apache.maven.plugin.mapping.MavenPluginMappingBuilder;
-import org.apache.maven.plugin.mapping.PluginMappingManagementException;
-import org.apache.maven.plugin.mapping.PluginMappingManager;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.injection.ModelDefaultsInjector;
@@ -287,106 +284,71 @@
}
private Map findMappingsForLifecycle( MavenSession session, MavenProject
project )
- throws LifecycleExecutionException
+ throws ArtifactResolutionException, LifecycleExecutionException
{
- Map mappings;
-
String packaging = project.getPackaging();
- try
- {
- PluginMappingManager mappingManager = getPluginMappingManager(
session, project );
-
- Plugin pluginContainingLifecycleMapping =
mappingManager.getByPackaging( packaging );
-
- LifecycleMapping m;
-
- if ( pluginContainingLifecycleMapping != null )
- {
- try
- {
- pluginManager.verifyPlugin(
pluginContainingLifecycleMapping, project, session.getSettings(),
- session.getLocalRepository() );
-
- m = (LifecycleMapping) pluginManager.getPluginComponent(
pluginContainingLifecycleMapping,
-
LifecycleMapping.ROLE, packaging );
-
- mappings = m.getPhases();
- }
- catch ( ComponentLookupException e )
- {
- throw new LifecycleExecutionException( "Plugin: " +
pluginContainingLifecycleMapping.getKey() +
- " declares lifecycle mapping for: \'" + packaging +
- "\', but does not appear to contain the actual mapping
among its component descriptors.", e );
- }
- }
- else
- {
- try
- {
- m = (LifecycleMapping) session.lookup(
LifecycleMapping.ROLE, packaging );
+ LifecycleMapping m;
- mappings = m.getPhases();
- }
- catch ( ComponentLookupException e )
- {
- getLogger().warn(
- "Lifecycle mappings not found for packaging: \'" +
packaging + "\'. Using defaults." );
-
- getLogger().debug( "Lifecycle mappings not found for
packaging: \'" + packaging + "\'.", e );
-
- mappings = defaultPhases;
- }
- }
- }
- catch ( ArtifactResolutionException e )
+ try
{
- throw new LifecycleExecutionException(
- "Cannot load plugin which defines lifecycle mappings for: \'"
+ packaging + "\'.", e );
+ m = (LifecycleMapping) findExtension( project,
LifecycleMapping.ROLE, packaging, session.getSettings(),
+ session.getLocalRepository()
);
}
catch ( PluginVersionResolutionException e )
{
throw new LifecycleExecutionException(
- "Cannot load plugin which defines lifecycle mappings for: \'"
+ packaging + "\'.", e );
+ "Cannot load extension plugin obtaining lifecycle mappings
for: \'" + packaging + "\'.", e );
}
catch ( PluginManagerException e )
{
- throw new LifecycleExecutionException( "Cannot load lifecycle
mappings.", e );
+ throw new LifecycleExecutionException(
+ "Cannot load extension plugin obtaining lifecycle mappings
for: \'" + packaging + "\'.", e );
}
- return mappings;
- }
-
- private PluginMappingManager getPluginMappingManager( MavenSession
session, MavenProject project )
- throws LifecycleExecutionException
- {
- PluginMappingManager mappingManager =
session.getPluginMappingManager();
-
- // don't reassemble the plugin mappings if the session has already
been configured with them.
- if ( mappingManager == null )
+ if ( m == null )
{
try
{
- List pluginGroupIds = session.getSettings().getPluginGroups();
- List pluginRepositories =
project.getPluginArtifactRepositories();
- ArtifactRepository localRepository =
session.getLocalRepository();
-
- mappingManager = pluginMappingBuilder.loadPluginMappings(
pluginGroupIds, pluginRepositories,
-
localRepository );
-
- // lazily configure this on the session.
- session.setPluginMappingManager( mappingManager );
+ m = (LifecycleMapping) session.lookup( LifecycleMapping.ROLE,
packaging );
}
- catch ( RepositoryMetadataManagementException e )
+ catch ( ComponentLookupException e )
{
- throw new LifecycleExecutionException( "Cannot load plugin
mappings.", e );
+ getLogger().warn(
+ "Lifecycle mappings not found for packaging: \'" +
packaging + "\'. Using defaults." );
+
+ getLogger().debug( "Lifecycle mappings not found for
packaging: \'" + packaging + "\'.", e );
+
+ return defaultPhases;
}
- catch ( PluginMappingManagementException e )
+ }
+
+ return m.getPhases();
+ }
+
+ private Object findExtension( MavenProject project, String role, String
roleHint, Settings settings,
+ ArtifactRepository localRepository )
+ throws ArtifactResolutionException, PluginManagerException,
PluginVersionResolutionException
+ {
+ for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
+ {
+ Plugin plugin = (Plugin) i.next();
+
+ if ( plugin.isExtensions() )
{
- throw new LifecycleExecutionException( "Cannot load plugin
mappings.", e );
+ pluginManager.verifyPlugin( plugin, project, settings,
localRepository );
+
+ // TODO: if moved to the plugin manager we already have the
descriptor from above and so do can lookup the container directly
+ try
+ {
+ return pluginManager.getPluginComponent( plugin, role,
roleHint );
+ }
+ catch ( ComponentLookupException e )
+ {
+ getLogger().debug( "Unable to find the lifecycle component
in the extension", e );
+ }
}
}
-
- return mappingManager;
+ return null;
}
/**
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
(original)
+++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Tue Jul 26 02:04:32 2005
@@ -617,20 +617,20 @@
if ( resourceUrl == null )
{
artifactResolver.resolve( artifact, unresolved,
localRepository );
-
+
artifactFile = artifact.getFile();
}
else
{
String artifactPath = resourceUrl.getPath();
-
+
if ( artifactPath.startsWith( "file:" ) )
{
artifactPath = artifactPath.substring(
"file:".length() );
}
artifactPath = artifactPath.substring( 0,
artifactPath.length() - resource.length() );
-
+
if ( artifactPath.endsWith( "/" ) )
{
artifactPath = artifactPath.substring( 0,
artifactPath.length() - 1 );
Modified: maven/components/trunk/maven-model/maven.mdo
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-model/maven.mdo?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
--- maven/components/trunk/maven-model/maven.mdo (original)
+++ maven/components/trunk/maven-model/maven.mdo Tue Jul 26 02:04:32 2005
@@ -2229,6 +2229,13 @@
<type>String</type>
</field>
<field>
+ <name>extensions</name>
+ <version>4.0.0</version>
+ <type>boolean</type>
+ <description>Whether to load Maven extensions (such as packaging and
type handlers) from this plugin</description>
+ <defaultValue>false</defaultValue>
+ </field>
+ <field>
<name>executions</name>
<version>4.0.0</version>
<description>Multiple specifications of a set of goals, each having
(possibly) different
Modified:
maven/components/trunk/maven-plugin-mapping/src/main/java/org/apache/maven/plugin/mapping/PluginMappingManager.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-mapping/src/main/java/org/apache/maven/plugin/mapping/PluginMappingManager.java?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
---
maven/components/trunk/maven-plugin-mapping/src/main/java/org/apache/maven/plugin/mapping/PluginMappingManager.java
(original)
+++
maven/components/trunk/maven-plugin-mapping/src/main/java/org/apache/maven/plugin/mapping/PluginMappingManager.java
Tue Jul 26 02:04:32 2005
@@ -26,15 +26,12 @@
public class PluginMappingManager
{
-
private List mappings = new ArrayList();
private boolean refreshed;
private Map pluginDefinitionsByPrefix = new HashMap();
- private Map pluginDefinitionsByPackaging = new HashMap();
-
public void addPluginMap( PluginMap pluginMap )
{
mappings.add( pluginMap );
@@ -65,7 +62,6 @@
private void clearCache()
{
- this.pluginDefinitionsByPackaging = null;
this.pluginDefinitionsByPrefix = null;
}
@@ -79,51 +75,6 @@
}
return (Plugin) pluginDefinitionsByPrefix.get( pluginPrefix );
- }
-
- public Plugin getByPackaging( String packaging )
- {
- synchronized ( this ) {
- if ( pluginDefinitionsByPackaging == null )
- {
- calculatePluginDefinitionsByPackaging();
- }
- }
-
- return (Plugin) pluginDefinitionsByPackaging.get( packaging );
- }
-
- private void calculatePluginDefinitionsByPackaging()
- {
- pluginDefinitionsByPackaging = new HashMap();
-
- for ( Iterator it = mappings.iterator(); it.hasNext(); )
- {
- PluginMap pluginMap = (PluginMap) it.next();
-
- String groupId = pluginMap.getGroupId();
-
- for ( Iterator pluginIterator = pluginMap.getPlugins().iterator();
pluginIterator.hasNext(); )
- {
- MappedPlugin mapping = (MappedPlugin) pluginIterator.next();
-
- String artifactId = mapping.getArtifactId();
-
- Plugin plugin = new Plugin();
-
- plugin.setGroupId( groupId );
-
- plugin.setArtifactId( artifactId );
-
- for ( Iterator packagingIterator =
mapping.getPackagingHandlers().iterator();
- packagingIterator.hasNext(); )
- {
- String packaging = (String) packagingIterator.next();
-
- pluginDefinitionsByPackaging.put( packaging, plugin );
- }
- }
- }
}
private void calculatePluginDefinitionsByPrefix()
Modified: maven/components/trunk/maven-plugin-mapping/src/main/mdo/plugins.mdo
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-mapping/src/main/mdo/plugins.mdo?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-mapping/src/main/mdo/plugins.mdo
(original)
+++ maven/components/trunk/maven-plugin-mapping/src/main/mdo/plugins.mdo Tue
Jul 26 02:04:32 2005
@@ -53,6 +53,7 @@
<version>1.0.0</version>
<description>The plugin artifactId</description>
</field>
+ <!-- TODO: deprecated: remove -->
<field>
<name>packagingHandlers</name>
<version>1.0.0</version>
Modified:
maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AbstractPluginMappingMojo.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AbstractPluginMappingMojo.java?rev=225263&r1=225262&r2=225263&view=diff
==============================================================================
---
maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AbstractPluginMappingMojo.java
(original)
+++
maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AbstractPluginMappingMojo.java
Tue Jul 26 02:04:32 2005
@@ -1,9 +1,24 @@
package org.apache.maven.plugin.plugin.metadata;
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
-import org.apache.maven.lifecycle.mapping.LifecycleMapping;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
@@ -12,20 +27,9 @@
import org.apache.maven.plugin.mapping.io.xpp3.PluginMappingXpp3Reader;
import org.apache.maven.plugin.mapping.io.xpp3.PluginMappingXpp3Writer;
import org.apache.maven.project.MavenProject;
-import org.codehaus.classworlds.ClassRealm;
-import org.codehaus.classworlds.ClassWorld;
-import org.codehaus.classworlds.DuplicateRealmException;
-import org.codehaus.plexus.component.discovery.ComponentDiscoverer;
import org.codehaus.plexus.component.discovery.ComponentDiscovererManager;
import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
-import org.codehaus.plexus.component.discovery.DefaultComponentDiscoverer;
-import org.codehaus.plexus.component.discovery.PlexusXmlComponentDiscoverer;
-import org.codehaus.plexus.component.repository.ComponentDescriptor;
-import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
-import org.codehaus.plexus.configuration.PlexusConfigurationException;
-import org.codehaus.plexus.context.Context;
-import org.codehaus.plexus.context.DefaultContext;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
@@ -36,8 +40,6 @@
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -166,8 +168,6 @@
mappedPlugin.setPrefix( getGoalPrefix() );
- mappedPlugin.setPackagingHandlers( extractPackagingHandlers() );
-
pluginMap.addPlugin( mappedPlugin );
Writer writer = null;
@@ -203,80 +203,6 @@
return shouldUpdate;
}
- private List extractPackagingHandlers()
- throws MojoExecutionException
- {
- List packagingHandlers = new ArrayList();
-
- Context ctx = new DefaultContext();
-
- ClassWorld discoveryWorld = new ClassWorld();
-
- try
- {
- ClassRealm discoveryRealm = discoveryWorld.newRealm(
"packageHandler-discovery" );
-
- File classDir = new File( classesDirectory ).getAbsoluteFile();
-
- discoveryRealm.addConstituent( classDir.toURL() );
-
- packagingHandlers
- .addAll( discoverLifecycleMappings( ctx, discoveryRealm, new
DefaultComponentDiscoverer() ) );
-
- packagingHandlers.addAll( discoverLifecycleMappings( ctx,
discoveryRealm,
- new
PlexusXmlComponentDiscoverer() ) );
- }
- catch ( DuplicateRealmException e )
- {
- throw new MojoExecutionException( "Error constructing class-realm
for lifecycle-mapping detection.", e );
- }
- catch ( MalformedURLException e )
- {
- throw new MojoExecutionException( "Error constructing class-realm
for lifecycle-mapping detection.", e );
- }
- catch ( PlexusConfigurationException e )
- {
- throw new MojoExecutionException( "Error detecting
lifecycle-mappings.", e );
- }
-
- return packagingHandlers;
- }
-
- private List discoverLifecycleMappings( Context ctx, ClassRealm
discoveryRealm, ComponentDiscoverer discoverer )
- throws PlexusConfigurationException
- {
- discoverer.setManager( new DummyComponentDiscovererManager() );
-
- List packagingHandlers = new ArrayList();
-
- List componentSetDescriptors = discoverer.findComponents( ctx,
discoveryRealm );
-
- if ( componentSetDescriptors != null )
- {
- for ( Iterator it = componentSetDescriptors.iterator();
it.hasNext(); )
- {
- ComponentSetDescriptor setDescriptor =
(ComponentSetDescriptor) it.next();
-
- List components = setDescriptor.getComponents();
-
- if ( components != null )
- {
- for ( Iterator componentIterator = components.iterator();
componentIterator.hasNext(); )
- {
- ComponentDescriptor descriptor = (ComponentDescriptor)
componentIterator.next();
-
- if ( LifecycleMapping.ROLE.equals(
descriptor.getRole() ) )
- {
- packagingHandlers.add( descriptor.getRoleHint() );
- }
- }
- }
- }
- }
-
- return packagingHandlers;
- }
-
private String getGoalPrefix()
{
if ( goalPrefix == null )
@@ -285,41 +211,5 @@
}
return goalPrefix;
- }
-
- public static class DummyComponentDiscovererManager
- implements ComponentDiscovererManager
- {
-
- DummyComponentDiscovererManager()
- {
- }
-
- public List getComponentDiscoverers()
- {
- return null;
- }
-
- public void registerComponentDiscoveryListener(
ComponentDiscoveryListener listener )
- {
- }
-
- public void removeComponentDiscoveryListener(
ComponentDiscoveryListener listener )
- {
- }
-
- public void fireComponentDiscoveryEvent( ComponentDiscoveryEvent event
)
- {
- }
-
- public void initialize()
- {
- }
-
- public List getListenerDescriptors()
- {
- return null;
- }
-
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]