Rolling back merge attempt until I have time to fix failing unit tests (most likely tomorrow will do it).

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@679244 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2008-07-24 00:18:09 +00:00
parent 3c9be4bceb
commit 24176a08a1
14 changed files with 30 additions and 219 deletions

View File

@ -28,7 +28,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.lifecycle.binding.LifecycleBindingManager;
import org.apache.maven.lifecycle.binding.MojoBindingFactory;
import org.apache.maven.lifecycle.model.MojoBinding;
import org.apache.maven.lifecycle.plan.BuildPlan;
@ -92,8 +91,6 @@ public class DefaultLifecycleExecutor
private BuildPlanner buildPlanner;
private MojoBindingFactory mojoBindingFactory;
private LifecycleBindingManager lifecycleBindingManager;
// this is needed for setting the lookup realm before we start building a project.
private PlexusContainer container;
@ -962,9 +959,4 @@ public class DefaultLifecycleExecutor
{
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
public List getLifecycles()
{
return lifecycleBindingManager.getLifecycles();
}
}

View File

@ -19,8 +19,6 @@ package org.apache.maven.lifecycle;
* under the License.
*/
import java.util.List;
import org.apache.maven.BuildFailureException;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
@ -58,9 +56,4 @@ public interface LifecycleExecutor
void execute( MavenSession session, ReactorManager rm, EventDispatcher dispatcher )
throws LifecycleExecutionException, BuildFailureException;
/**
* @since 2.0.10
*/
List getLifecycles();
}

View File

@ -64,18 +64,13 @@ public class DefaultLifecycleBindingManager
private Logger logger;
// configured. Moved out of DefaultLifecycleExecutor...
private List<org.apache.maven.lifecycle.binding.Lifecycle> lifecycles;
private List lifecycles;
// configured. Moved out of DefaultLifecycleExecutor...
private List defaultReports;
// contextualized, used for setting lookup realm before retrieving lifecycle bindings for packaging.
private PlexusContainer container;
public List<org.apache.maven.lifecycle.binding.Lifecycle> getLifecycles()
{
return lifecycles;
}
/**
* {@inheritDoc}

View File

@ -82,6 +82,4 @@ public interface LifecycleBindingManager
final LifecycleBindings lifecycleBindings )
throws LifecycleSpecificationException;
List<org.apache.maven.lifecycle.binding.Lifecycle> getLifecycles();
}

View File

@ -426,9 +426,6 @@ under the License.
<requirement>
<role>org.apache.maven.lifecycle.binding.MojoBindingFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.lifecycle.binding.LifecycleBindingManager</role>
</requirement>
</requirements>
</component>
@ -820,15 +817,6 @@ under the License.
<!-- END SNIPPET: default-reports -->
</configuration>
</component>
<component>
<role>org.apache.maven.artifact.manager.WagonManager</role>
<role-hint>default</role-hint>
<implementation>org.apache.maven.artifact.manager.DefaultWagonManager</implementation>
<configuration>
<httpUserAgent>Apache-Maven/2.1 (Java @java.version@; @os.name@ @os.version@) maven-artifact/${project.version}</httpUserAgent>
</configuration>
</component>
<component>
<role>org.apache.maven.lifecycle.plan.BuildPlanner</role>

View File

@ -1087,8 +1087,6 @@ public class DefaultMavenProjectBuilder
dPlugin.setGroupId( iPlugin.getGroupId() );
dPlugin.setArtifactId( iPlugin.getArtifactId() );
dPlugin.setVersion( iPlugin.getVersion() );
dPlugin.setDependencies( iPlugin.getDependencies() );
}
}
@ -1110,8 +1108,6 @@ public class DefaultMavenProjectBuilder
dPlugin.setGroupId( iPlugin.getGroupId() );
dPlugin.setArtifactId( iPlugin.getArtifactId() );
dPlugin.setVersion( iPlugin.getVersion() );
dPlugin.setDependencies( iPlugin.getDependencies() );
}
}
}

View File

@ -562,8 +562,6 @@ public final class ModelUtils
public static Model cloneModel( Model model )
{
// TODO: would be nice for the modello:java code to generate this as a copy constructor
// FIXME: Fix deep cloning issues with existing plugin instances (setting
// a version when resolved will pollute the original model instance)
Model newModel = new Model();
ModelInheritanceAssembler assembler = new DefaultModelInheritanceAssembler();
newModel.setModelVersion( model.getModelVersion() );

View File

@ -101,34 +101,22 @@ public class MavenMetadataSource
return artifact;
}
ProjectRelocation rel = retrieveRelocatedProject( artifact, localRepository, remoteRepositories );
if ( rel == null )
{
return artifact;
}
MavenProject project = rel.project;
ProjectRelocation res = retrieveRelocatedProject( artifact, localRepository, remoteRepositories );
MavenProject project = res.project;
if ( project == null || getRelocationKey( artifact ).equals( getRelocationKey( project.getArtifact() ) ) )
{
return artifact;
}
// NOTE: Using artifact information here, since some POMs are deployed
// to central with one version in the filename, but another in the <version> string!
// Case in point: org.apache.ws.commons:XmlSchema:1.1:pom.
//
// Since relocation triggers a reconfiguration of the artifact's information
// in retrieveRelocatedProject(..), this is safe to do.
Artifact result = null;
if ( artifact.getClassifier() != null )
{
result = artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier() );
result = artifactFactory.createArtifactWithClassifier( project.getGroupId(), project.getArtifactId(), project.getVersion(), artifact.getType(), artifact.getClassifier() );
}
else
{
result = artifactFactory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getScope(), artifact.getType() );
result = artifactFactory.createArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), artifact.getScope(), artifact.getType() );
}
result.setScope( artifact.getScope() );

View File

@ -1,5 +1,3 @@
package org.apache.maven.project.interpolation;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -19,34 +17,33 @@ package org.apache.maven.project.interpolation;
* under the License.
*/
package org.apache.maven.project.interpolation;
import org.apache.maven.project.path.PathTranslator;
import org.codehaus.plexus.interpolation.AbstractFunctionValueSourceWrapper;
import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
import org.codehaus.plexus.interpolation.ValueSource;
import java.io.File;
import java.util.List;
/**
*
* @version $Id: PathTranslatingPostProcessor.java 677447 2008-07-16 22:15:57Z jdcasey $
*/
public class PathTranslatingPostProcessor
implements InterpolationPostProcessor
public class PathTranslatingValueSource
extends AbstractFunctionValueSourceWrapper
{
private final List unprefixedPathKeys;
private final List<String> unprefixedPathKeys;
private final File projectDir;
private final PathTranslator pathTranslator;
public PathTranslatingPostProcessor( List unprefixedPathKeys, File projectDir, PathTranslator pathTranslator )
protected PathTranslatingValueSource( ValueSource valueSource, List<String> unprefixedPathKeys, File projectDir, PathTranslator pathTranslator )
{
super( valueSource );
this.unprefixedPathKeys = unprefixedPathKeys;
this.projectDir = projectDir;
this.pathTranslator = pathTranslator;
}
public Object execute( String expression,
@Override
protected Object executeFunction( String expression,
Object value )
{
if ( projectDir != null && value != null && unprefixedPathKeys.contains( expression ) )

View File

@ -88,12 +88,6 @@ public class RegexBasedModelInterpolator
throws IOException
{
}
// for testing.
protected RegexBasedModelInterpolator( PathTranslator pathTranslator )
{
this.pathTranslator = pathTranslator;
}
public Model interpolate( Model model, Map<String, ?> context )
throws ModelInterpolationException
@ -205,8 +199,15 @@ public class RegexBasedModelInterpolator
timestampFormat = modelProperties.getProperty( BUILD_TIMESTAMP_FORMAT_PROPERTY, timestampFormat );
}
ValueSource modelValueSource1 = new PrefixedObjectValueSource( PROJECT_PREFIXES, model, false );
ValueSource modelValueSource2 = new ObjectBasedValueSource( model );
ValueSource baseModelValueSource1 = new PrefixedObjectValueSource( PROJECT_PREFIXES, model, false );
ValueSource modelValueSource1 = new PathTranslatingValueSource( baseModelValueSource1,
TRANSLATED_PATH_EXPRESSIONS,
projectDir, pathTranslator );
ValueSource baseModelValueSource2 = new ObjectBasedValueSource( model );
ValueSource modelValueSource2 = new PathTranslatingValueSource( baseModelValueSource2,
TRANSLATED_PATH_EXPRESSIONS,
projectDir, pathTranslator );
ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new ValueSource(){
public Object getValue( String expression )
@ -231,11 +232,6 @@ public class RegexBasedModelInterpolator
interpolator.addValueSource( new PrefixedValueSourceWrapper( new MapBasedValueSource( modelProperties ), PROJECT_PREFIXES, true ) );
interpolator.addValueSource( modelValueSource2 );
interpolator.addValueSource( new MapBasedValueSource( config.getUserProperties() ) );
PathTranslatingPostProcessor pathTranslatingPostProcessor =
new PathTranslatingPostProcessor( TRANSLATED_PATH_EXPRESSIONS, projectDir, pathTranslator );
interpolator.addPostProcessor( pathTranslatingPostProcessor );
RecursionInterceptor recursionInterceptor = new PrefixAwareRecursionInterceptor( PROJECT_PREFIXES );

View File

@ -115,7 +115,7 @@ under the License.
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.4.2</version>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-rar-plugin</artifactId>
@ -131,7 +131,7 @@ under the License.
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.0-beta-7</version>
<version>2.0-beta-6</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
@ -139,7 +139,7 @@ under the License.
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<version>2.4.2</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>

View File

@ -19,25 +19,19 @@ package org.apache.maven.project.interpolation;
* under the License.
*/
import org.apache.maven.model.Build;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DeploymentRepository;
import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Model;
import org.apache.maven.model.Organization;
import org.apache.maven.model.Repository;
import org.apache.maven.model.Resource;
import org.apache.maven.model.Scm;
import org.apache.maven.project.DefaultProjectBuilderConfiguration;
import org.apache.maven.project.ProjectBuilderConfiguration;
import org.apache.maven.project.path.DefaultPathTranslator;
import org.apache.maven.project.path.PathTranslator;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@ -303,83 +297,4 @@ public class RegexBasedModelInterpolatorTest
assertEquals( "Expected '" + expectedVersion + "' for version expression '" + depVersionExpr + "', but was '" + result + "'", expectedVersion, result );
}
public void testShouldInterpolateSourceDirectoryReferencedFromResourceDirectoryCorrectly()
throws Exception
{
Model model = new Model();
Build build = new Build();
build.setSourceDirectory( "correct" );
Resource res = new Resource();
res.setDirectory( "${project.build.sourceDirectory}" );
build.addResource( res );
Resource res2 = new Resource();
res2.setDirectory( "${pom.build.sourceDirectory}" );
build.addResource( res2 );
Resource res3 = new Resource();
res3.setDirectory( "${build.sourceDirectory}" );
build.addResource( res3 );
model.setBuild( build );
Model out = new RegexBasedModelInterpolator().interpolate( model, context );
List outResources = out.getBuild().getResources();
Iterator resIt = outResources.iterator();
assertEquals( build.getSourceDirectory(), ( (Resource) resIt.next() ).getDirectory() );
assertEquals( build.getSourceDirectory(), ( (Resource) resIt.next() ).getDirectory() );
assertEquals( build.getSourceDirectory(), ( (Resource) resIt.next() ).getDirectory() );
}
public void testShouldInterpolateUnprefixedBasedirExpression()
throws ModelInterpolationException, IOException
{
File basedir = new File( "/test/path" );
Model model = new Model();
Dependency dep = new Dependency();
dep.setSystemPath( "${basedir}/artifact.jar" );
model.addDependency( dep );
Model result = new RegexBasedModelInterpolator().interpolate( model, basedir, new DefaultProjectBuilderConfiguration(), true );
List rDeps = result.getDependencies();
assertNotNull( rDeps );
assertEquals( 1, rDeps.size() );
assertEquals( new File( basedir, "artifact.jar" ).getAbsolutePath(), new File( ( (Dependency) rDeps.get( 0 ) )
.getSystemPath() ).getAbsolutePath() );
}
public void testTwoLevelRecursiveBasedirAlignedExpression()
throws Exception
{
Model model = new Model();
Build build = new Build();
model.setBuild( build );
build.setDirectory( "${project.basedir}/target" );
build.setOutputDirectory( "${project.build.directory}/classes" );
PathTranslator translator = new DefaultPathTranslator();
RegexBasedModelInterpolator interpolator = new RegexBasedModelInterpolator( translator );
File basedir = new File( System.getProperty( "java.io.tmpdir" ), "base" );
String value = interpolator.interpolate( "${project.build.outputDirectory}/foo", model, basedir, new DefaultProjectBuilderConfiguration(), true );
value = value.replace( '/', File.separatorChar ).replace( '\\', File.separatorChar );
String check = new File( basedir, "target/classes/foo" ).getAbsolutePath();
check = check.replace( '/', File.separatorChar ).replace( '\\', File.separatorChar );
assertEquals( check, value );
}
}

View File

@ -1,24 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>testing</groupId>
<artifactId>plugin-level-dep</artifactId>
<packaging>jar</packaging>
<version>3.8.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${pom.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

27
pom.xml
View File

@ -202,27 +202,6 @@
<artifactId>maven-bundle-plugin</artifactId>
<version>1.0.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<!-- needed for release: default value "(,${project.version})" for 2.0.10 is 2.0.10-SNAPSHOT -->
<comparisonVersion>2.0.9</comparisonVersion>
<excludes>
<!-- TODO: These represent method ADDITIONS from 2.0.9, and should be removed after
2.0.10 is released. -->
<exclude>org/apache/maven/lifecycle/LifecycleExecutor*</exclude>
<exclude>org/apache/maven/artifact/metadata/ArtifactMetadataSource*</exclude>
<exclude>org/apache/maven/project/MavenProjectBuilder*</exclude>
<exclude>org/apache/maven/project/ProjectBuilderConfiguration*</exclude>
<exclude>org/apache/maven/project/interpolation/ModelInterpolator*</exclude>
<exclude>org/apache/maven/project/inheritance/ModelInheritanceAssembler*</exclude>
<exclude>org/apache/maven/execution/MavenExecutionRequest*</exclude>
<exclude>org/apache/maven/plugin/DefaultPluginManager*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@ -259,7 +238,7 @@
<module>maven-toolchain</module>
</modules>
<properties>
<artifactVersion>3.0-alpha-2-SNAPSHOT</artifactVersion>
<artifactVersion>3.0-SNAPSHOT</artifactVersion>
<aspectjVersion>1.5.3</aspectjVersion>
<classWorldsVersion>1.2-alpha-13</classWorldsVersion>
<commonsCliVersion>1.0</commonsCliVersion>
@ -268,8 +247,8 @@
<junitVersion>3.8.1</junitVersion>
<plexusVersion>1.0-alpha-48</plexusVersion>
<plexusInteractivityVersion>1.0-alpha-6</plexusInteractivityVersion>
<plexusInterpolationVersion>1.1</plexusInterpolationVersion>
<plexusUtilsVersion>1.5.5</plexusUtilsVersion>
<plexusInterpolationVersion>1.0</plexusInterpolationVersion>
<plexusUtilsVersion>1.5.4</plexusUtilsVersion>
<wagonVersion>1.0-beta-3</wagonVersion>
</properties>