o updating to the new version of plexus which is the unified JAR once again. I can now move on

to doxia and attempt to use the same container for the trunk and branch.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@560496 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-07-28 04:57:37 +00:00
parent a87abe2d26
commit 6583991465
8 changed files with 94 additions and 17 deletions

View File

@ -17,11 +17,11 @@
classworlds.version=1.2-alpha-7
plexus-active-collections.version=1.0-beta-1
plexus.version=1.0-alpha-24
plexus-utils.version=1.4.3-SNAPSHOT
plexus.version=1.0-alpha-29
plexus-utils.version=1.4.3
commons-cli.version=1.0
wagon.version=1.0-beta-2
doxia.version=1.0-alpha-9-SNAPSHOT
modello.version=1.0-alpha-13
modello.version=1.0-alpha-16
junit.version=3.8.1
jdom.version=1.0

View File

@ -119,7 +119,6 @@ under the License.
<pull orgpath="org/codehaus/plexus/plexus-active-collections" version="${plexus-active-collections.version}" name="plexus-active-collections" repository="codehaus"/>
<pull orgpath="org/codehaus/plexus/plexus-utils" version="${plexus-utils.version}" name="plexus-utils" repository="codehaus"/>
<pull orgpath="org/codehaus/plexus/plexus-container-default" version="${plexus.version}" name="plexus-container-default" repository="codehaus"/>
<pull orgpath="org/codehaus/plexus/plexus-component-api" version="${plexus.version}" name="plexus-component-api" repository="codehaus"/>
<pull orgpath="org/codehaus/plexus/plexus-classworlds" version="${classworlds.version}" name="plexus-classworlds" repository="codehaus"/>
<pull orgpath="org/apache/maven/maven-parent" version="4" name="maven-parent" type="pom"/>
<pull orgpath="org/apache/maven/plugins/maven-plugins" version="4-SNAPSHOT" name="maven-plugins" type="pom"/>
@ -148,7 +147,6 @@ under the License.
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-active-collections/${plexus-active-collections.version}/plexus-active-collections-${plexus-active-collections.version}.jar"/>
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-utils/${plexus-utils.version}/plexus-utils-${plexus-utils.version}.jar"/>
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-container-default/${plexus.version}/plexus-container-default-${plexus.version}.jar"/>
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-component-api/${plexus.version}/plexus-component-api-${plexus.version}.jar"/>
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-classworlds/${classworlds.version}/plexus-classworlds-${classworlds.version}.jar"/>
<pathelement location="${maven.repo.local}/org/codehaus/plexus/plexus-interactivity-api/${plexus-interactivity-api.version}/plexus-interactivity-api-${plexus-interactivity-api.version}.jar"/>
<pathelement location="${maven.repo.local}/org/apache/maven/wagon/wagon-manager/${wagon.version}/wagon-manager-${wagon.version}.jar"/>

View File

@ -20,11 +20,17 @@ package org.apache.maven.extension;
*/
import org.apache.maven.ArtifactFilterManager;
import org.apache.maven.plugin.DefaultPluginManager;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.metadata.ResolutionGroup;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
@ -46,6 +52,8 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
/**
* Used to locate extensions.
@ -130,9 +138,30 @@ public class DefaultExtensionManager
ArtifactFilter filter =
new ProjectArtifactExceptionFilter( artifactFilterManager.getArtifactFilter(), projectArtifact );
ResolutionGroup resolutionGroup;
try
{
resolutionGroup = artifactMetadataSource.retrieve( extensionArtifact, localRepository, remoteRepositories );
}
catch ( ArtifactMetadataRetrievalException e )
{
throw new ArtifactResolutionException( "Unable to download metadata from repository for plugin '" +
extensionArtifact.getId() + "': " + e.getMessage(), extensionArtifact, e );
}
// We use the same hack here to make sure that plexus 1.1 is available for extensions that do
// not declare plexus-utils but need it. MNG-2900
DefaultPluginManager.checkPlexusUtils( resolutionGroup, artifactFactory );
Set dependencies = new HashSet( resolutionGroup.getArtifacts() );
dependencies.add( extensionArtifact );
// TODO: Make this work with managed dependencies, or an analogous management section in the POM.
ArtifactResolutionResult result =
artifactResolver.resolveTransitively( Collections.singleton( extensionArtifact ), projectArtifact,
artifactResolver.resolveTransitively( dependencies, projectArtifact,
Collections.EMPTY_MAP, localRepository, remoteRepositories,
artifactMetadataSource, filter );
@ -202,4 +231,53 @@ public class DefaultExtensionManager
}
}
public static void checkPlexusUtils( ResolutionGroup resolutionGroup, ArtifactFactory artifactFactory )
{
// ----------------------------------------------------------------------------
// If the plugin already declares a dependency on plexus-utils then we're all
// set as the plugin author is aware of its use. If we don't have a dependency
// on plexus-utils then we must protect users from stupid plugin authors who
// did not declare a direct dependency on plexus-utils because the version
// Maven uses is hidden from downstream use. We will also bump up any
// anything below 1.1 to 1.1 as this mimics the behaviour in 2.0.5 where
// plexus-utils 1.1 was being forced into use.
// ----------------------------------------------------------------------------
VersionRange vr = null;
try
{
vr = VersionRange.createFromVersionSpec( "[1.1,)" );
}
catch ( InvalidVersionSpecificationException e )
{
// Won't happen
}
boolean plexusUtilsPresent = false;
for ( Iterator i = resolutionGroup.getArtifacts().iterator(); i.hasNext(); )
{
Artifact a = (Artifact) i.next();
if ( a.getArtifactId().equals( "plexus-utils" ) &&
vr.containsVersion( new DefaultArtifactVersion( a.getVersion() ) ) )
{
plexusUtilsPresent = true;
break;
}
}
if ( !plexusUtilsPresent )
{
// We will add plexus-utils as every plugin was getting this anyway from Maven itself. We will set the
// version to the latest version we know that works as of the 2.0.6 release. We set the scope to runtime
// as this is what's implicitly happening in 2.0.6.
resolutionGroup.getArtifacts().add( artifactFactory.createArtifact( "org.codehaus.plexus",
"plexus-utils", "1.1",
Artifact.SCOPE_RUNTIME, "jar" ) );
}
}
}

View File

@ -43,7 +43,7 @@ under the License.
<plugin>
<artifactId>shade-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.0-alpha-4</version>
<version>1.0-alpha-8-SNAPSHOT</version>
<executions>
<execution>
<phase>package</phase>
@ -51,8 +51,12 @@ under the License.
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.codehaus.mojo.shade.resource.ComponentsXmlResourceTransformer"/>
</transformers>
<artifactSet>
<excludes>
<exclude>org.codehaus.plexus:plexus-component-api</exclude>
<exclude>classworlds:classworlds</exclude>
<exclude>junit:junit</exclude>
<exclude>jmock:jmock</exclude>

View File

@ -61,7 +61,7 @@ under the License.
<directory>target</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>maven-embedder-*uber.jar</include>
<include>maven-embedder-*.jar</include>
</includes>
</fileSet>
</fileSets>

View File

@ -40,6 +40,8 @@ public abstract class AbstractEmbedderTestCase
{
super.setUp();
System.out.println( ">>> " + getBasedir() );
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Configuration configuration = new DefaultConfiguration()

View File

@ -25,7 +25,7 @@ import java.io.File;
/** @author Jason van Zyl */
public class MavenEmbedderBehaviorTest
extends PlexusTestCase
extends AbstractEmbedderTestCase
{
public void testThatTheLocalRepositoryIsTakenFromGlobalSettingsWhenUserSettingsAreNull()
throws Exception

11
pom.xml
View File

@ -80,7 +80,7 @@ under the License.
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>1.0-alpha-13</version>
<version>1.0-alpha-16-SNAPSHOT</version>
<executions>
<execution>
<id>site-docs</id>
@ -128,7 +128,7 @@ under the License.
<module>maven-embedder</module>
</modules>
<properties>
<plexusVersion>1.0-alpha-25</plexusVersion>
<plexusVersion>1.0-alpha-29</plexusVersion>
<wagonVersion>1.0-beta-2</wagonVersion>
</properties>
<dependencies>
@ -146,11 +146,6 @@ under the License.
<artifactId>plexus-container-default</artifactId>
<version>${plexusVersion}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
<version>${plexusVersion}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
@ -159,7 +154,7 @@ under the License.
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.4.3-SNAPSHOT</version>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>