mirror of https://github.com/apache/maven.git
o Removed duplicate class
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@825301 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
60b6c026c9
commit
865134cd8e
|
@ -1,114 +0,0 @@
|
||||||
package org.apache.maven.artifact.resolver;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you 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.repository.ArtifactTransferEvent;
|
|
||||||
import org.apache.maven.repository.ArtifactTransferListener;
|
|
||||||
import org.apache.maven.repository.MavenArtifact;
|
|
||||||
import org.apache.maven.wagon.events.TransferEvent;
|
|
||||||
import org.apache.maven.wagon.events.TransferListener;
|
|
||||||
import org.apache.maven.wagon.resource.Resource;
|
|
||||||
|
|
||||||
public class TransferListenerAdapter
|
|
||||||
implements TransferListener
|
|
||||||
{
|
|
||||||
|
|
||||||
private ArtifactTransferListener listener;
|
|
||||||
|
|
||||||
public static TransferListener newAdapter( ArtifactTransferListener listener )
|
|
||||||
{
|
|
||||||
if ( listener == null )
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new TransferListenerAdapter( listener );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private TransferListenerAdapter( ArtifactTransferListener listener )
|
|
||||||
{
|
|
||||||
this.listener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void debug( String message )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void transferCompleted( TransferEvent transferEvent )
|
|
||||||
{
|
|
||||||
listener.transferCompleted( wrap( transferEvent ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void transferError( TransferEvent transferEvent )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void transferInitiated( TransferEvent transferEvent )
|
|
||||||
{
|
|
||||||
listener.transferInitiated( wrap( transferEvent ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length )
|
|
||||||
{
|
|
||||||
listener.transferProgress( wrap( transferEvent ), buffer, length );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void transferStarted( TransferEvent transferEvent )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArtifactTransferEvent wrap( TransferEvent event )
|
|
||||||
{
|
|
||||||
if ( event == null )
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
String wagon = event.getWagon().getRepository().getUrl();
|
|
||||||
|
|
||||||
MavenArtifact artifact = wrap( event.getResource() );
|
|
||||||
|
|
||||||
if ( event.getException() != null )
|
|
||||||
{
|
|
||||||
return new ArtifactTransferEvent( wagon, event.getException(), event.getRequestType(), artifact );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new ArtifactTransferEvent( wagon, event.getEventType(), event.getRequestType(), artifact );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private MavenArtifact wrap( Resource resource )
|
|
||||||
{
|
|
||||||
if ( resource == null )
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new MavenArtifact( resource.getName(), resource.getContentLength() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -588,7 +588,9 @@ public class LegacyRepositorySystem
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
wagonManager.getRemoteFile( repository, destination, remotePath, new TransferListenerAdapter( transferListener ), ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN, true );
|
wagonManager.getRemoteFile( repository, destination, remotePath,
|
||||||
|
TransferListenerAdapter.newAdapter( transferListener ),
|
||||||
|
ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN, true );
|
||||||
}
|
}
|
||||||
catch ( org.apache.maven.wagon.TransferFailedException e )
|
catch ( org.apache.maven.wagon.TransferFailedException e )
|
||||||
{
|
{
|
||||||
|
@ -605,7 +607,8 @@ public class LegacyRepositorySystem
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
wagonManager.putRemoteFile( repository, source, remotePath, new TransferListenerAdapter( transferListener ) );
|
wagonManager.putRemoteFile( repository, source, remotePath,
|
||||||
|
TransferListenerAdapter.newAdapter( transferListener ) );
|
||||||
}
|
}
|
||||||
catch ( org.apache.maven.wagon.TransferFailedException e )
|
catch ( org.apache.maven.wagon.TransferFailedException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,40 +1,114 @@
|
||||||
package org.apache.maven.repository.legacy;
|
package org.apache.maven.repository.legacy;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you 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.repository.ArtifactTransferEvent;
|
||||||
import org.apache.maven.repository.ArtifactTransferListener;
|
import org.apache.maven.repository.ArtifactTransferListener;
|
||||||
|
import org.apache.maven.repository.MavenArtifact;
|
||||||
import org.apache.maven.wagon.events.TransferEvent;
|
import org.apache.maven.wagon.events.TransferEvent;
|
||||||
import org.apache.maven.wagon.events.TransferListener;
|
import org.apache.maven.wagon.events.TransferListener;
|
||||||
|
import org.apache.maven.wagon.resource.Resource;
|
||||||
|
|
||||||
public class TransferListenerAdapter
|
public class TransferListenerAdapter
|
||||||
implements TransferListener
|
implements TransferListener
|
||||||
{
|
{
|
||||||
private ArtifactTransferListener transferListener;
|
|
||||||
|
|
||||||
public TransferListenerAdapter( ArtifactTransferListener transferListener )
|
private ArtifactTransferListener listener;
|
||||||
|
|
||||||
|
public static TransferListener newAdapter( ArtifactTransferListener listener )
|
||||||
{
|
{
|
||||||
this.transferListener = transferListener;
|
if ( listener == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new TransferListenerAdapter( listener );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug( String arg0 )
|
private TransferListenerAdapter( ArtifactTransferListener listener )
|
||||||
|
{
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug( String message )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transferCompleted( TransferEvent arg0 )
|
public void transferCompleted( TransferEvent transferEvent )
|
||||||
|
{
|
||||||
|
listener.transferCompleted( wrap( transferEvent ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transferError( TransferEvent transferEvent )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transferError( TransferEvent arg0 )
|
public void transferInitiated( TransferEvent transferEvent )
|
||||||
|
{
|
||||||
|
listener.transferInitiated( wrap( transferEvent ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length )
|
||||||
|
{
|
||||||
|
listener.transferProgress( wrap( transferEvent ), buffer, length );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transferStarted( TransferEvent transferEvent )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transferInitiated( TransferEvent arg0 )
|
private ArtifactTransferEvent wrap( TransferEvent event )
|
||||||
{
|
{
|
||||||
|
if ( event == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String wagon = event.getWagon().getRepository().getUrl();
|
||||||
|
|
||||||
|
MavenArtifact artifact = wrap( event.getResource() );
|
||||||
|
|
||||||
|
if ( event.getException() != null )
|
||||||
|
{
|
||||||
|
return new ArtifactTransferEvent( wagon, event.getException(), event.getRequestType(), artifact );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new ArtifactTransferEvent( wagon, event.getEventType(), event.getRequestType(), artifact );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transferProgress( TransferEvent arg0, byte[] arg1, int arg2 )
|
private MavenArtifact wrap( Resource resource )
|
||||||
{
|
{
|
||||||
|
if ( resource == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new MavenArtifact( resource.getName(), resource.getContentLength() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transferStarted( TransferEvent arg0 )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,12 +34,12 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||||
import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
|
import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
|
||||||
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
|
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
|
||||||
import org.apache.maven.artifact.resolver.TransferListenerAdapter;
|
|
||||||
import org.apache.maven.artifact.resolver.filter.CumulativeScopeArtifactFilter;
|
import org.apache.maven.artifact.resolver.filter.CumulativeScopeArtifactFilter;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.project.artifact.ProjectArtifact;
|
import org.apache.maven.project.artifact.ProjectArtifact;
|
||||||
import org.apache.maven.repository.RepositorySystem;
|
import org.apache.maven.repository.RepositorySystem;
|
||||||
|
import org.apache.maven.repository.legacy.TransferListenerAdapter;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||||
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
|
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
|
||||||
import org.apache.maven.artifact.resolver.TransferListenerAdapter;
|
|
||||||
import org.apache.maven.model.Build;
|
import org.apache.maven.model.Build;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
|
@ -43,6 +42,7 @@ import org.apache.maven.model.building.UrlModelSource;
|
||||||
import org.apache.maven.model.resolution.ModelResolver;
|
import org.apache.maven.model.resolution.ModelResolver;
|
||||||
import org.apache.maven.project.artifact.ProjectArtifact;
|
import org.apache.maven.project.artifact.ProjectArtifact;
|
||||||
import org.apache.maven.repository.RepositorySystem;
|
import org.apache.maven.repository.RepositorySystem;
|
||||||
|
import org.apache.maven.repository.legacy.TransferListenerAdapter;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
import org.codehaus.plexus.util.Os;
|
import org.codehaus.plexus.util.Os;
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||||
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
|
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
|
||||||
import org.apache.maven.artifact.resolver.TransferListenerAdapter;
|
|
||||||
import org.apache.maven.model.Repository;
|
import org.apache.maven.model.Repository;
|
||||||
import org.apache.maven.model.building.FileModelSource;
|
import org.apache.maven.model.building.FileModelSource;
|
||||||
import org.apache.maven.model.building.ModelSource;
|
import org.apache.maven.model.building.ModelSource;
|
||||||
|
@ -38,6 +37,7 @@ import org.apache.maven.model.resolution.InvalidRepositoryException;
|
||||||
import org.apache.maven.model.resolution.ModelResolver;
|
import org.apache.maven.model.resolution.ModelResolver;
|
||||||
import org.apache.maven.model.resolution.UnresolvableModelException;
|
import org.apache.maven.model.resolution.UnresolvableModelException;
|
||||||
import org.apache.maven.repository.RepositorySystem;
|
import org.apache.maven.repository.RepositorySystem;
|
||||||
|
import org.apache.maven.repository.legacy.TransferListenerAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a model resolver backed by the Maven Repository API and the reactor.
|
* Implements a model resolver backed by the Maven Repository API and the reactor.
|
||||||
|
|
Loading…
Reference in New Issue