diff --git a/build.xml b/build.xml index 5c845f4308..8ebd735baa 100644 --- a/build.xml +++ b/build.xml @@ -65,7 +65,7 @@ END SNIPPET: ant-bootstrap --> - + maven.home = ${maven.home.effective} maven.repo.local = ${maven.repo.local} diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml index ba025334b1..30842784c7 100644 --- a/maven-compat/pom.xml +++ b/maven-compat/pom.xml @@ -43,7 +43,10 @@ org.apache.maven.wagon wagon-file - test + + + org.apache.maven.wagon + wagon-http-lightweight easymock diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java index 2a7817a1f1..11d816510e 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java @@ -23,6 +23,7 @@ import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.metadata.ArtifactMetadata; @@ -817,4 +818,9 @@ public class DefaultWagonManager { return httpUserAgent; } + + public Set getSupportProtocols() + { + return wagons.keySet(); + } } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java index 99f22eabc2..206611bcfb 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java @@ -21,6 +21,8 @@ package org.apache.maven.artifact.manager; import java.io.File; import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.metadata.ArtifactMetadata; @@ -85,4 +87,6 @@ public interface WagonManager void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File file, String checksumPolicyWarn ) throws TransferFailedException, ResourceDoesNotExistException; + + Set getSupportProtocols(); } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 1b76800ebe..9dcb7461e3 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -155,6 +155,8 @@ public class DefaultArtifactResolver boolean resolved = false; + boolean destinationExists = destination.exists(); + // There are three conditions in which we'll go after the artifact here: // 1. the force flag is set. // 2. the artifact's file doesn't exist (this would be true for release or snapshot artifacts) diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java index baed3be2a0..9d79dab729 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DefaultArtifact; @@ -75,7 +76,8 @@ public class DefaultWagonManagerTest public void testAvailableProtocols() throws Exception { - wagonManager.getWagon( "file" ); + Set protocols = wagonManager.getSupportProtocols(); + System.out.println( protocols ); } public void testUnnecessaryRepositoryLookup() throws Exception { @@ -284,9 +286,7 @@ public class DefaultWagonManagerTest { assertWagon( "a" ); - assertWagon( "b1" ); - - assertWagon( "b2" ); + assertWagon( "b" ); assertWagon( "c" ); diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/StringWagon.java b/maven-compat/src/test/java/org/apache/maven/artifact/manager/StringWagon.java index 44a67a9ccf..439d6dd0c2 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/StringWagon.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/manager/StringWagon.java @@ -31,10 +31,13 @@ import org.apache.maven.wagon.OutputData; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.StreamWagon; import org.apache.maven.wagon.TransferFailedException; +import org.apache.maven.wagon.Wagon; import org.apache.maven.wagon.authentication.AuthenticationException; import org.apache.maven.wagon.authorization.AuthorizationException; import org.apache.maven.wagon.resource.Resource; +import org.codehaus.plexus.component.annotations.Component; +@Component(role=Wagon.class,hint="string") public class StringWagon extends StreamWagon { diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonA.java b/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonA.java index b21fe737b6..3a69fafd0e 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonA.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonA.java @@ -1,5 +1,8 @@ package org.apache.maven.artifact.manager; +import org.apache.maven.wagon.Wagon; +import org.codehaus.plexus.component.annotations.Component; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -26,6 +29,7 @@ package org.apache.maven.artifact.manager; * @author Jason van Zyl * @version $Id$ */ +@Component(role=Wagon.class,hint="a") public class WagonA extends WagonMock { diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonB.java b/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonB.java index 42fce6bddb..83775d1ca6 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonB.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonB.java @@ -1,5 +1,8 @@ package org.apache.maven.artifact.manager; +import org.apache.maven.wagon.Wagon; +import org.codehaus.plexus.component.annotations.Component; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -26,6 +29,7 @@ package org.apache.maven.artifact.manager; * @author Jason van Zyl * @version $Id$ */ +@Component(role=Wagon.class,hint="b") public class WagonB extends WagonMock { diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonC.java b/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonC.java index d2404beec6..7b6eb52e08 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonC.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonC.java @@ -1,5 +1,8 @@ package org.apache.maven.artifact.manager; +import org.apache.maven.wagon.Wagon; +import org.codehaus.plexus.component.annotations.Component; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -26,6 +29,7 @@ package org.apache.maven.artifact.manager; * @author Jason van Zyl * @version $Id$ */ +@Component(role=Wagon.class,hint="c") public class WagonC extends WagonMock { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index 2b16c42e72..2e7998bf14 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -428,7 +428,6 @@ public class DefaultLifecycleExecutor // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process MojoDescriptor getMojoDescriptor( String task, MavenProject project, ArtifactRepository localRepository ) - //MojoDescriptor getMojoDescriptor( String groupId, String artifactId, String version, String goal, MavenProject project, ArtifactRepository localRepository ) throws LifecycleExecutionException { String goal; @@ -495,7 +494,7 @@ public class DefaultLifecycleExecutor String message = "Invalid task '" + task + "': you must specify a valid lifecycle phase, or" + " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal"; throw new LifecycleExecutionException( message ); } - + for ( Plugin buildPlugin : project.getBuildPlugins() ) { if ( buildPlugin.getKey().equals( plugin.getKey() ) ) @@ -511,7 +510,7 @@ public class DefaultLifecycleExecutor MojoDescriptor mojoDescriptor; try - { + { mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, project, localRepository ); } catch ( PluginLoaderException e ) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index edd1dd2f1f..7803394f7c 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -40,7 +40,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ResolutionErrorHandler; import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Dependency; @@ -51,7 +50,6 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder; import org.apache.maven.project.DuplicateArtifactAttachmentException; import org.apache.maven.project.MavenProject; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.classworlds.realm.ClassRealm; diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java index cdd085fe38..cb3b50bd54 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java @@ -43,7 +43,7 @@ public class DefaultProjectBuilderConfiguration private MavenProject topProject; - private boolean processPlugins = false; + private boolean processPlugins = true; public DefaultProjectBuilderConfiguration() { diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java index 82e0afff52..949b086b0f 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java @@ -61,6 +61,28 @@ public class LifecycleExecutorTest // surefire:test // jar:jar +// resources:resources +// resources:resources +// compiler:compile +// compiler:compile +// plexus-component-metadata:generate-metadata +// resources:testResources +// resources:testResources +// compiler:testCompile +// compiler:testCompile +// plexus-component-metadata:generate-test-metadata +// surefire:test +// surefire:test +// jar:jar +// jar:jar + + /* + for( MojoExecution e : lifecyclePlan ) + { + System.out.println( e.getMojoDescriptor().getFullGoalName() ); + } + */ + assertEquals( "resources:resources", lifecyclePlan.get( 0 ).getMojoDescriptor().getFullGoalName() ); assertEquals( "compiler:compile", lifecyclePlan.get( 1 ).getMojoDescriptor().getFullGoalName() ); assertEquals( "plexus-component-metadata:generate-metadata", lifecyclePlan.get( 2 ).getMojoDescriptor().getFullGoalName() ); diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java index cf760bb004..9f43eec134 100644 --- a/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java +++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java @@ -54,7 +54,7 @@ public class PluginManagerTest assertNotNull( mojoDescriptor ); assertEquals( "generate-metadata", mojoDescriptor.getGoal() ); assertNotNull( mojoDescriptor.getRealm() ); - mojoDescriptor.getRealm().display(); + //mojoDescriptor.getRealm().display(); PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor(); assertNotNull( pluginDescriptor );