You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2009/07/13 22:42:22 UTC
svn commit: r793706 - in /maven/maven-2/branches/maven-2.2.x:
maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/
maven-artifact-manager/src/main/resources/META-INF/plexus/
maven-artifact-manager/src/test/java/org/apache/maven/artif...
Author: jdcasey
Date: Mon Jul 13 20:42:21 2009
New Revision: 793706
URL: http://svn.apache.org/viewvc?rev=793706&view=rev
Log:
[MNG-4228] Fixing ITs after changing wagon manager to use mappings to lookup specific wagon component role-hints to use for a protocol. Also, using ComponentDescriptor lookup instead of component lookup to find extension wagons to register.
Modified:
maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/resources/META-INF/plexus/components.xml
maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
maven/maven-2/branches/maven-2.2.x/maven-core/pom.xml
maven/maven-2/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml
Modified: maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java?rev=793706&r1=793705&r2=793706&view=diff
==============================================================================
--- maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java (original)
+++ maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java Mon Jul 13 20:42:21 2009
@@ -83,9 +83,7 @@
private static final String MAVEN_ARTIFACT_PROPERTIES = "META-INF/maven/org.apache.maven/maven-artifact/pom.properties";
- public static final String DELEGATE_PROPERTY_BASE = "maven.wagon.";
-
- private static final String WAGON_IMPL_CONFIGURATION = "wagonImpl";
+ private static final String WAGON_PROVIDER_CONFIGURATION = "wagonProvider";
private static int anonymousMirrorIdSeed = 0;
@@ -118,6 +116,8 @@
private RepositoryPermissions defaultRepositoryPermissions;
private String httpUserAgent;
+
+ private WagonProviderMapping providerMapping = new DefaultWagonProviderMapping();
// TODO: this leaks the component in the public api - it is never released back to the container
public Wagon getWagon( Repository repository )
@@ -178,7 +178,7 @@
for ( int i = 0; i < dom.getChildCount(); i++ )
{
Xpp3Dom domChild = dom.getChild( i );
- if ( WAGON_IMPL_CONFIGURATION.equals( domChild.getName() ) )
+ if ( WAGON_PROVIDER_CONFIGURATION.equals( domChild.getName() ) )
{
impl = domChild.getValue();
dom.removeChild( i );
@@ -191,7 +191,7 @@
if ( impl == null )
{
- impl = System.getProperty( DELEGATE_PROPERTY_BASE + protocol, null );
+ impl = providerMapping.getWagonProvider( protocol );
}
return impl == null ? protocol : protocol + "-" + impl;
@@ -1205,6 +1205,11 @@
serverConfigurationMap.put( repositoryId, xmlConf );
}
+
+ public void setWagonProvider( String protocol, String provider )
+ {
+ providerMapping.setWagonProvider( protocol, provider );
+ }
public void setDefaultRepositoryPermissions( RepositoryPermissions defaultRepositoryPermissions )
{
Modified: maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java?rev=793706&r1=793705&r2=793706&view=diff
==============================================================================
--- maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java (original)
+++ maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java Mon Jul 13 20:42:21 2009
@@ -126,4 +126,11 @@
void setDefaultRepositoryPermissions( RepositoryPermissions permissions );
ArtifactRepository getMirrorRepository( ArtifactRepository repository );
+
+ /**
+ * Set the provider name for selecting one Wagon from a range of possible implementations for
+ * the give protocol. This provider name is combined with the protocol to form the role-hint
+ * for Wagon lookup, using the format: <code>[protocol]-[provider]</code>.
+ */
+ void setWagonProvider( String protocol, String provider );
}
Modified: maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/resources/META-INF/plexus/components.xml?rev=793706&r1=793705&r2=793706&view=diff
==============================================================================
--- maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/main/resources/META-INF/plexus/components.xml Mon Jul 13 20:42:21 2009
@@ -31,8 +31,19 @@
<requirement>
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
</requirement>
+ <requirement>
+ <role>org.apache.maven.artifact.manager.WagonProviderMapping</role>
+ <role-hint>maven</role-hint>
+ </requirement>
</requirements>
</component>
+
+ <!-- This component should be redefined to introduce new default provider mappings in maven-core. -->
+ <component>
+ <role>org.apache.maven.artifact.manager.WagonProviderMapping</role>
+ <role-hint>maven</role-hint>
+ <implementation>org.apache.maven.artifact.manager.DefaultWagonProviderMapping</implementation>
+ </component>
<component>
<role>org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager</role>
Modified: maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java?rev=793706&r1=793705&r2=793706&view=diff
==============================================================================
--- maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java (original)
+++ maven/maven-2/branches/maven-2.2.x/maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java Mon Jul 13 20:42:21 2009
@@ -19,9 +19,6 @@
* under the License.
*/
-import java.io.File;
-import java.io.IOException;
-
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
@@ -40,6 +37,9 @@
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
+import java.io.File;
+import java.io.IOException;
+
import edu.umd.cs.mtc.MultithreadedTestCase;
import edu.umd.cs.mtc.TestFramework;
Modified: maven/maven-2/branches/maven-2.2.x/maven-core/pom.xml
URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-core/pom.xml?rev=793706&r1=793705&r2=793706&view=diff
==============================================================================
--- maven/maven-2/branches/maven-2.2.x/maven-core/pom.xml (original)
+++ maven/maven-2/branches/maven-2.2.x/maven-core/pom.xml Mon Jul 13 20:42:21 2009
@@ -43,6 +43,15 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-parameter-documenter</artifactId>
</dependency>
+ <!-- This is bizarre, but it seems that putting this AFTER wagon-http
+ causes the shade plugin to completely SKIP adding some parts of
+ commons-httpclient. At least the RequestEntity interface is missing
+ in the resulting output, and ITs will start failing left and right...
+ -->
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-http-lightweight</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
@@ -65,13 +74,6 @@
</exclusion>
</exclusions>
</dependency>
- <!-- NOTE: Listing this last causes it to be the default Wagon implementation
- when the bare protocol is used to lookup the http/https wagons.
- -->
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-http-lightweight</artifactId>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
Modified: maven/maven-2/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=793706&r1=793705&r2=793706&view=diff
==============================================================================
--- maven/maven-2/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/maven-2/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Mon Jul 13 20:42:21 2009
@@ -795,6 +795,19 @@
wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
}
+
+ for ( Object k: executionProperties.keySet() )
+ {
+ String key = (String) k;
+ if ( key.startsWith( "maven.wagon.provider." ) )
+ {
+ String provider = executionProperties.getProperty( key );
+ key = key.substring( "maven.wagon.provider.".length() );
+
+ wagonManager.setWagonProvider( key, provider );
+ }
+
+ }
}
finally
{
Modified: maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=793706&r1=793705&r2=793706&view=diff
==============================================================================
--- maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml Mon Jul 13 20:42:21 2009
@@ -624,15 +624,28 @@
</component>
<component>
+ <role>org.apache.maven.artifact.manager.WagonProviderMapping</role>
+ <role-hint>maven</role-hint>
+ <implementation>org.apache.maven.artifact.manager.DefaultWagonProviderMapping</implementation>
+ <configuration>
+ <wagonProviders>
+ <http>lightweight</http>
+ <http>lightweight</http>
+ </wagonProviders>
+ </configuration>
+ </component>
+
+ <!-- TODO: The following wagon component definitions need to be moved into the proper wagon-* projects... -->
+ <component>
<role>org.apache.maven.wagon.Wagon</role>
- <role-hint>http-sun</role-hint>
+ <role-hint>http-lightweight</role-hint>
<implementation>org.apache.maven.wagon.providers.http.LightweightHttpWagon</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
<description>LightweightHttpWagon</description>
</component>
<component>
<role>org.apache.maven.wagon.Wagon</role>
- <role-hint>https-sun</role-hint>
+ <role-hint>https-lightweight</role-hint>
<implementation>org.apache.maven.wagon.providers.http.LightweightHttpsWagon</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
<description>LIghtweightHttpsWagon</description>
Re: svn commit: r793706 - in /maven/maven-2/branches/maven-2.2.x:
maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/ maven-artifact-manager/src/main/resources/META-INF/plexus/
maven-artifact-manager/src/test/java/org/apache/maven/artif...
Posted by John Casey <jd...@commonjava.org>.
Yeah, this looks fine.
BTW, I'm officially done using git-svn. While I like Git as a tool in
itself, the workflow of git-svn is dangerous IMO. All of the code fixes
you put in place after I did the RC last week were already in my local
git repo, I just forgot to call `git svn dcommit`.
Unbelievable.
Apologies for the sloppy process.
-john
Brett Porter wrote:
>
> On 27/07/2009, at 3:02 AM, Brett Porter wrote:
>
>>
>>>
>>> Modified:
>>> maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml
>>>
>>> URL:
>>> http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=793706&r1=793705&r2=793706&view=diff
>>>
>>> ==============================================================================
>>>
>>> ---
>>> maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml
>>> (original)
>>> +++
>>> maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml
>>> Mon Jul 13 20:42:21 2009
>>> @@ -624,15 +624,28 @@
>>> </component>
>>>
>>> <component>
>>> +
>>> <role>org.apache.maven.artifact.manager.WagonProviderMapping</role>
>>> + <role-hint>maven</role-hint>
>>> +
>>> <implementation>org.apache.maven.artifact.manager.DefaultWagonProviderMapping</implementation>
>>>
>>> + <configuration>
>>> + <wagonProviders>
>>> + <http>lightweight</http>
>>> + <http>lightweight</http>
>>> + </wagonProviders>
>>> + </configuration>
>>> + </component>
>>
>> should the second one here be <https> ?
>
> Since this type of override doesn't always work in Plexus, I made a
> change to set it programmatically (Which is consistent with everything
> else in this regard). Does the change look ok to you?
>
> - Brett
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r793706 - in /maven/maven-2/branches/maven-2.2.x: maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/ maven-artifact-manager/src/main/resources/META-INF/plexus/ maven-artifact-manager/src/test/java/org/apache/maven/artif...
Posted by Brett Porter <br...@apache.org>.
On 27/07/2009, at 3:02 AM, Brett Porter wrote:
>
>>
>> Modified: maven/maven-2/branches/maven-2.2.x/maven-core/src/main/
>> resources/META-INF/plexus/components.xml
>> URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=793706&r1=793705&r2=793706&view=diff
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- maven/maven-2/branches/maven-2.2.x/maven-core/src/main/
>> resources/META-INF/plexus/components.xml (original)
>> +++ maven/maven-2/branches/maven-2.2.x/maven-core/src/main/
>> resources/META-INF/plexus/components.xml Mon Jul 13 20:42:21 2009
>> @@ -624,15 +624,28 @@
>> </component>
>>
>> <component>
>> +
>> <role>org.apache.maven.artifact.manager.WagonProviderMapping</role>
>> + <role-hint>maven</role-hint>
>> +
>> <
>> implementation
>> >org.apache.maven.artifact.manager.DefaultWagonProviderMapping</
>> implementation>
>> + <configuration>
>> + <wagonProviders>
>> + <http>lightweight</http>
>> + <http>lightweight</http>
>> + </wagonProviders>
>> + </configuration>
>> + </component>
>
> should the second one here be <https> ?
Since this type of override doesn't always work in Plexus, I made a
change to set it programmatically (Which is consistent with everything
else in this regard). Does the change look ok to you?
- Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r793706 - in /maven/maven-2/branches/maven-2.2.x: maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/ maven-artifact-manager/src/main/resources/META-INF/plexus/ maven-artifact-manager/src/test/java/org/apache/maven/artif...
Posted by Brett Porter <br...@apache.org>.
Hi John,
On 14/07/2009, at 6:42 AM, jdcasey@apache.org wrote:
> Author: jdcasey
> Date: Mon Jul 13 20:42:21 2009
> New Revision: 793706
>
> URL: http://svn.apache.org/viewvc?rev=793706&view=rev
> Log:
> [MNG-4228] Fixing ITs after changing wagon manager to use mappings
> to lookup specific wagon component role-hints to use for a protocol.
> Also, using ComponentDescriptor lookup instead of component lookup
> to find extension wagons to register.
>
[snip]
> Modified: maven/maven-2/branches/maven-2.2.x/maven-core/src/main/
> java/org/apache/maven/DefaultMaven.java
> URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=793706&r1=793705&r2=793706&view=diff
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- maven/maven-2/branches/maven-2.2.x/maven-core/src/main/java/org/
> apache/maven/DefaultMaven.java (original)
> +++ maven/maven-2/branches/maven-2.2.x/maven-core/src/main/java/org/
> apache/maven/DefaultMaven.java Mon Jul 13 20:42:21 2009
> @@ -795,6 +795,19 @@
>
> wagonManager.addMirror( mirror.getId(),
> mirror.getMirrorOf(), mirror.getUrl() );
> }
> +
> + for ( Object k: executionProperties.keySet() )
> + {
> + String key = (String) k;
I prefer the synax
for ( String key : (Collection<String>) executionProperties.keySet() ) {
myself :)
>
> Modified: maven/maven-2/branches/maven-2.2.x/maven-core/src/main/
> resources/META-INF/plexus/components.xml
> URL: http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=793706&r1=793705&r2=793706&view=diff
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/
> META-INF/plexus/components.xml (original)
> +++ maven/maven-2/branches/maven-2.2.x/maven-core/src/main/resources/
> META-INF/plexus/components.xml Mon Jul 13 20:42:21 2009
> @@ -624,15 +624,28 @@
> </component>
>
> <component>
> + <role>org.apache.maven.artifact.manager.WagonProviderMapping</
> role>
> + <role-hint>maven</role-hint>
> +
> <
> implementation
> >org.apache.maven.artifact.manager.DefaultWagonProviderMapping</
> implementation>
> + <configuration>
> + <wagonProviders>
> + <http>lightweight</http>
> + <http>lightweight</http>
> + </wagonProviders>
> + </configuration>
> + </component>
should the second one here be <https> ?
Cheers,
Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org