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 f407ff924d..b89fa3f512 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
@@ -169,13 +169,11 @@ public class DefaultArtifactResolver
if ( artifact.getRepository() != null )
{
// the transformations discovered the artifact - so use it exclusively
- wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor,
- request.isForceUpdate() );
+ wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor, request.isForceUpdate() );
}
else
{
- wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor,
- request.isForceUpdate() );
+ wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor, request.isForceUpdate() );
}
}
catch ( ResourceDoesNotExistException e )
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/BatchModeDownloadMonitorTest.java b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java
similarity index 65%
rename from maven-embedder/src/test/java/org/apache/maven/cli/BatchModeDownloadMonitorTest.java
rename to maven-compat/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java
index 7bf1369080..296f4ea56a 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/BatchModeDownloadMonitorTest.java
+++ b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java
@@ -1,4 +1,4 @@
-package org.apache.maven.cli;
+package org.apache.maven.repository;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -9,7 +9,7 @@ package org.apache.maven.cli;
* "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
+ * 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
@@ -19,18 +19,16 @@ package org.apache.maven.cli;
* under the License.
*/
-/**
- * Test for {@link BatchModeDownloadMonitor}
- *
- * @author Carlos Sanchez
- * @version $Id$
- */
-public class BatchModeDownloadMonitorTest
- extends AbstractConsoleDownloadMonitorTest
+public class ArtifactDoesNotExistException
+ extends Exception
{
- protected void setUp()
- throws Exception
+ public ArtifactDoesNotExistException( final String message )
{
- monitor = new BatchModeDownloadMonitor();
+ super( message );
+ }
+
+ public ArtifactDoesNotExistException( final String message, final Throwable cause )
+ {
+ super( message, cause );
}
}
diff --git a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java
new file mode 100644
index 0000000000..05525f1f58
--- /dev/null
+++ b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java
@@ -0,0 +1,292 @@
+package org.apache.maven.repository;
+
+/*
+ * 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 java.io.File;
+import java.util.EventObject;
+
+/**
+ * TransferEvent is used to notify TransferListeners about progress
+ * in transfer of resources form/to the repository
+ *
+ * @author Michal Maczka
+ * @version $Id$
+ */
+public class ArtifactTransferEvent
+ extends EventObject
+{
+ /**
+ * A transfer was attempted, but has not yet commenced.
+ */
+ public static final int TRANSFER_INITIATED = 0;
+
+ /**
+ * A transfer was started.
+ */
+ public static final int TRANSFER_STARTED = 1;
+
+ /**
+ * A transfer is completed.
+ */
+ public static final int TRANSFER_COMPLETED = 2;
+
+ /**
+ * A transfer is in progress.
+ */
+ public static final int TRANSFER_PROGRESS = 3;
+
+ /**
+ * An error occurred during transfer
+ */
+ public static final int TRANSFER_ERROR = 4;
+
+ /**
+ * Indicates GET transfer (from the repository)
+ */
+ public static final int REQUEST_GET = 5;
+
+ /**
+ * Indicates PUT transfer (to the repository)
+ */
+ public static final int REQUEST_PUT = 6;
+
+ private int eventType;
+
+ private int requestType;
+
+ private Exception exception;
+
+ private File localFile;
+
+ private MavenArtifact artifact;
+
+ public ArtifactTransferEvent( String wagon, final int eventType, final int requestType )
+ {
+ super( wagon );
+
+ setEventType( eventType );
+
+ setRequestType( requestType );
+ }
+
+ public ArtifactTransferEvent( String wagon, final Exception exception, final int requestType )
+ {
+ this( wagon, TRANSFER_ERROR, requestType );
+
+ this.exception = exception;
+ }
+
+ public MavenArtifact getResource()
+ {
+ return artifact;
+ }
+
+ /**
+ * @return Returns the exception.
+ */
+ public Exception getException()
+ {
+ return exception;
+ }
+
+ /**
+ * Returns the request type.
+ *
+ * @return Returns the request type. The Request type is one of
+ * TransferEvent.REQUEST_GET or TransferEvent.REQUEST_PUT
+ */
+ public int getRequestType()
+ {
+ return requestType;
+ }
+
+ /**
+ * Sets the request type
+ *
+ * @param requestType The requestType to set.
+ * The Request type value should be either
+ * TransferEvent.REQUEST_GET or TransferEvent.REQUEST_PUT.
+ * @throws IllegalArgumentException when
+ */
+ public void setRequestType( final int requestType )
+ {
+ switch ( requestType )
+ {
+
+ case REQUEST_PUT:
+ break;
+ case REQUEST_GET:
+ break;
+
+ default :
+ throw new IllegalArgumentException( "Illegal request type: " + requestType );
+ }
+
+ this.requestType = requestType;
+ }
+
+ /**
+ * @return Returns the eventType.
+ */
+ public int getEventType()
+ {
+ return eventType;
+ }
+
+ /**
+ * @param eventType The eventType to set.
+ */
+ public void setEventType( final int eventType )
+ {
+ switch ( eventType )
+ {
+
+ case TRANSFER_INITIATED:
+ break;
+ case TRANSFER_STARTED:
+ break;
+ case TRANSFER_COMPLETED:
+ break;
+ case TRANSFER_PROGRESS:
+ break;
+ case TRANSFER_ERROR:
+ break;
+ default :
+ throw new IllegalArgumentException( "Illegal event type: " + eventType );
+ }
+
+ this.eventType = eventType;
+ }
+
+ /**
+ * @return Returns the local file.
+ */
+ public File getLocalFile()
+ {
+ return localFile;
+ }
+
+ /**
+ * @param localFile The local file to set.
+ */
+ public void setLocalFile( File localFile )
+ {
+ this.localFile = localFile;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( "TransferEvent[" );
+
+ switch ( this.getRequestType() )
+ {
+ case REQUEST_GET:
+ sb.append( "GET" );
+ break;
+ case REQUEST_PUT:
+ sb.append( "PUT" );
+ break;
+ default:
+ sb.append( this.getRequestType() );
+ break;
+ }
+
+ sb.append( "|" );
+ switch ( this.getEventType() )
+ {
+ case TRANSFER_COMPLETED:
+ sb.append( "COMPLETED" );
+ break;
+ case TRANSFER_ERROR:
+ sb.append( "ERROR" );
+ break;
+ case TRANSFER_INITIATED:
+ sb.append( "INITIATED" );
+ break;
+ case TRANSFER_PROGRESS:
+ sb.append( "PROGRESS" );
+ break;
+ case TRANSFER_STARTED:
+ sb.append( "STARTED" );
+ break;
+ default:
+ sb.append( this.getEventType() );
+ break;
+ }
+
+ sb.append( "|" );
+ sb.append( this.getLocalFile() ).append( "|" );
+ sb.append( "]" );
+
+ return sb.toString();
+ }
+
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + eventType;
+ result = prime * result + ( ( exception == null ) ? 0 : exception.hashCode() );
+ result = prime * result + ( ( localFile == null ) ? 0 : localFile.hashCode() );
+ result = prime * result + requestType;
+ return result;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+ if ( ( obj == null ) || ( getClass() != obj.getClass() ) )
+ {
+ return false;
+ }
+ final ArtifactTransferEvent other = (ArtifactTransferEvent) obj;
+ if ( eventType != other.eventType )
+ {
+ return false;
+ }
+ if ( exception == null )
+ {
+ if ( other.exception != null )
+ {
+ return false;
+ }
+ }
+ else if ( !exception.getClass().equals( other.exception.getClass() ) )
+ {
+ return false;
+ }
+ if ( requestType != other.requestType )
+ {
+ return false;
+ }
+ else if ( !source.equals( other.source ) )
+ {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java
new file mode 100644
index 0000000000..9315f4c7a5
--- /dev/null
+++ b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java
@@ -0,0 +1,35 @@
+package org.apache.maven.repository;
+
+/*
+ * 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.
+ */
+
+public class ArtifactTransferFailedException
+ extends Exception
+{
+ public ArtifactTransferFailedException( final String message )
+ {
+ super( message );
+ }
+
+ public ArtifactTransferFailedException( final String message, final Throwable cause )
+ {
+ super( message, cause );
+ }
+
+}
diff --git a/maven-core/src/main/java/org/apache/maven/MavenTransferListener.java b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java
similarity index 81%
rename from maven-core/src/main/java/org/apache/maven/MavenTransferListener.java
rename to maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java
index dfa14f5e5d..3e365b5fc4 100644
--- a/maven-core/src/main/java/org/apache/maven/MavenTransferListener.java
+++ b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java
@@ -1,4 +1,4 @@
-package org.apache.maven;
+package org.apache.maven.repository;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,14 +19,7 @@ package org.apache.maven;
* under the License.
*/
-import org.apache.maven.wagon.events.TransferListener;
-
-/**
- * @author Jason van Zyl
- * @version $Revision$
- */
-public interface MavenTransferListener
- extends TransferListener
+public interface ArtifactTransferListener
{
public boolean isShowChecksumEvents();
diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifact.java b/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifact.java
new file mode 100644
index 0000000000..e9ae6e5d8c
--- /dev/null
+++ b/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifact.java
@@ -0,0 +1,14 @@
+package org.apache.maven.repository;
+
+public class MavenArtifact
+{
+ public String getName()
+ {
+ return "";
+ }
+
+ public int getContentLength()
+ {
+ return 0;
+ }
+}
diff --git a/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java b/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java
index e0f3b501ca..0db6170b18 100644
--- a/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java
+++ b/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java
@@ -34,9 +34,6 @@ import org.apache.maven.model.Plugin;
import org.apache.maven.model.Repository;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Server;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.events.TransferListener;
/**
* @author Jason van Zyl
@@ -147,10 +144,10 @@ public interface RepositorySystem
//
// Raw file transfers
//
- void publish( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor )
- throws TransferFailedException;
+ void publish( ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener )
+ throws ArtifactTransferFailedException;
- void retrieve( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor )
- throws TransferFailedException, ResourceDoesNotExistException;
+ void retrieve( ArtifactRepository repository, File destination, String remotePath, ArtifactTransferListener transferListener )
+ throws ArtifactTransferFailedException, ArtifactDoesNotExistException;
}
diff --git a/maven-compat/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
similarity index 93%
rename from maven-compat/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java
rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
index 62807f20dd..8aa8489387 100644
--- a/maven-compat/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java
+++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
@@ -1,4 +1,4 @@
-package org.apache.maven.repository;
+package org.apache.maven.repository.legacy;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
@@ -45,15 +45,16 @@ import org.apache.maven.model.Repository;
import org.apache.maven.model.RepositoryPolicy;
import org.apache.maven.repository.DelegatingLocalArtifactRepository;
import org.apache.maven.repository.LocalArtifactRepository;
+import org.apache.maven.repository.ArtifactTransferListener;
import org.apache.maven.repository.MetadataResolutionRequest;
import org.apache.maven.repository.MetadataResolutionResult;
+import org.apache.maven.repository.MirrorSelector;
+import org.apache.maven.repository.Proxy;
import org.apache.maven.repository.RepositorySystem;
-import org.apache.maven.repository.legacy.WagonManager;
+import org.apache.maven.repository.ArtifactDoesNotExistException;
+import org.apache.maven.repository.ArtifactTransferFailedException;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Server;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.apache.maven.wagon.events.TransferListener;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
@@ -577,21 +578,39 @@ public class LegacyRepositorySystem
// ArtifactFilter filter,
// List listeners,
// List conflictResolvers )
-
- // ArtifactResolutionResult result = artifactCollector.
+ // ArtifactResolutionResult result = artifactCollector.
+
return null;
}
- public void retrieve( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor )
- throws TransferFailedException, ResourceDoesNotExistException
+ public void retrieve( ArtifactRepository repository, File destination, String remotePath, ArtifactTransferListener transferListener )
+ throws ArtifactTransferFailedException, ArtifactDoesNotExistException
{
- wagonManager.getRemoteFile( repository, destination, remotePath, downloadMonitor, ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN, true );
+ try
+ {
+ wagonManager.getRemoteFile( repository, destination, remotePath, new TransferListenerAdapter( transferListener ), ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN, true );
+ }
+ catch ( org.apache.maven.wagon.TransferFailedException e )
+ {
+ throw new ArtifactTransferFailedException( "Error transferring artifact.", e );
+ }
+ catch ( org.apache.maven.wagon.ResourceDoesNotExistException e )
+ {
+ throw new ArtifactDoesNotExistException( "Requested artifact does not exist.", e );
+ }
}
- public void publish( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor )
- throws TransferFailedException
+ public void publish( ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener )
+ throws ArtifactTransferFailedException
{
- wagonManager.putRemoteFile( repository, source, remotePath, downloadMonitor );
+ try
+ {
+ wagonManager.putRemoteFile( repository, source, remotePath, new TransferListenerAdapter( transferListener ) );
+ }
+ catch ( org.apache.maven.wagon.TransferFailedException e )
+ {
+ throw new ArtifactTransferFailedException( "Error transferring artifact.", e );
+ }
}
//
diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java
new file mode 100644
index 0000000000..053d94206b
--- /dev/null
+++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java
@@ -0,0 +1,40 @@
+package org.apache.maven.repository.legacy;
+
+import org.apache.maven.repository.ArtifactTransferListener;
+import org.apache.maven.wagon.events.TransferEvent;
+import org.apache.maven.wagon.events.TransferListener;
+
+public class TransferListenerAdapter
+ implements TransferListener
+{
+ private ArtifactTransferListener transferListener;
+
+ public TransferListenerAdapter( ArtifactTransferListener transferListener )
+ {
+ this.transferListener = transferListener;
+ }
+
+ public void debug( String arg0 )
+ {
+ }
+
+ public void transferCompleted( TransferEvent arg0 )
+ {
+ }
+
+ public void transferError( TransferEvent arg0 )
+ {
+ }
+
+ public void transferInitiated( TransferEvent arg0 )
+ {
+ }
+
+ public void transferProgress( TransferEvent arg0, byte[] arg1, int arg2 )
+ {
+ }
+
+ public void transferStarted( TransferEvent arg0 )
+ {
+ }
+}
diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java
index ae1c99ebca..4ead3b7544 100644
--- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java
+++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.repository.ArtifactTransferListener;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.UnsupportedProtocolException;
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java
index ff1e557421..a56b5462a6 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java
@@ -20,7 +20,6 @@ import java.util.Arrays;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.Authentication;
-import org.apache.maven.repository.LegacyRepositorySystem;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.settings.Server;
import org.codehaus.plexus.PlexusTestCase;
diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index 9f18a9ddb6..ae797a1759 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -80,20 +80,6 @@
commons-jxpath
test
-
- org.apache.maven.wagon
- wagon-provider-api
-
-
- org.apache.maven.wagon
- wagon-file
- test
-
-
- org.apache.maven.wagon
- wagon-http-lightweight
- test
-
diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
index 626f05d6c5..3891636099 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
@@ -30,10 +30,10 @@ import org.apache.maven.artifact.repository.RepositoryCache;
import org.apache.maven.model.Profile;
import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.repository.ArtifactTransferListener;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
-import org.apache.maven.wagon.events.TransferListener;
/**
* @author Jason van Zyl
@@ -112,7 +112,7 @@ public class DefaultMavenExecutionRequest
private List inactiveProfiles;
- private TransferListener transferListener;
+ private ArtifactTransferListener transferListener;
private int loggingLevel = LOGGING_LEVEL_INFO;
@@ -348,7 +348,7 @@ public class DefaultMavenExecutionRequest
return inactiveProfiles;
}
- public TransferListener getTransferListener()
+ public ArtifactTransferListener getTransferListener()
{
return transferListener;
}
@@ -585,7 +585,7 @@ public class DefaultMavenExecutionRequest
return this;
}
- public MavenExecutionRequest setTransferListener( TransferListener transferListener )
+ public MavenExecutionRequest setTransferListener( ArtifactTransferListener transferListener )
{
this.transferListener = transferListener;
diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
index 2efc6f3561..2ac483ea95 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
@@ -29,10 +29,10 @@ import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.RepositoryCache;
import org.apache.maven.model.Profile;
import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.repository.ArtifactTransferListener;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
-import org.apache.maven.wagon.events.TransferListener;
import org.codehaus.plexus.logging.Logger;
/**
@@ -164,8 +164,8 @@ public interface MavenExecutionRequest
boolean isShowErrors();
// Transfer listeners
- MavenExecutionRequest setTransferListener( TransferListener transferListener );
- TransferListener getTransferListener();
+ MavenExecutionRequest setTransferListener( ArtifactTransferListener transferListener );
+ ArtifactTransferListener getTransferListener();
// Logging
MavenExecutionRequest setLoggingLevel( int loggingLevel );
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java
index 7e99a3bae9..c22ee28ef6 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java
@@ -37,8 +37,8 @@ import org.apache.maven.plugin.prefix.PluginPrefixRequest;
import org.apache.maven.plugin.prefix.PluginPrefixResolver;
import org.apache.maven.plugin.prefix.PluginPrefixResult;
import org.apache.maven.repository.RepositorySystem;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
+import org.apache.maven.repository.ArtifactDoesNotExistException;
+import org.apache.maven.repository.ArtifactTransferFailedException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
@@ -173,7 +173,7 @@ public class DefaultPluginPrefixResolver
{
repositorySystem.retrieve( repository, destination, remotePath, null );
}
- catch ( TransferFailedException e )
+ catch ( ArtifactTransferFailedException e )
{
if ( logger.isDebugEnabled() )
{
@@ -186,7 +186,7 @@ public class DefaultPluginPrefixResolver
continue;
}
- catch ( ResourceDoesNotExistException e )
+ catch ( ArtifactDoesNotExistException e )
{
continue;
}
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java
index d1326a1fe5..7ccf448067 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java
@@ -32,8 +32,8 @@ import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.apache.maven.plugin.version.PluginVersionResolver;
import org.apache.maven.plugin.version.PluginVersionResult;
import org.apache.maven.repository.RepositorySystem;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
+import org.apache.maven.repository.ArtifactDoesNotExistException;
+import org.apache.maven.repository.ArtifactTransferFailedException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
@@ -86,7 +86,7 @@ public class DefaultPluginVersionResolver
{
repositorySystem.retrieve( repository, artifactMetadataFile, remotePath, null );
}
- catch ( TransferFailedException e )
+ catch ( ArtifactTransferFailedException e )
{
if ( logger.isDebugEnabled() )
{
@@ -99,7 +99,7 @@ public class DefaultPluginVersionResolver
continue;
}
- catch ( ResourceDoesNotExistException e )
+ catch ( ArtifactDoesNotExistException e )
{
continue;
}
diff --git a/maven-core/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java b/maven-core/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java
index 9c839095d3..c0abdaee5b 100644
--- a/maven-core/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java
+++ b/maven-core/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java
@@ -1,8 +1,8 @@
package org.apache.maven.project;
import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.repository.LegacyRepositorySystem;
import org.apache.maven.repository.RepositorySystem;
+import org.apache.maven.repository.legacy.LegacyRepositorySystem;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
diff --git a/maven-core/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java b/maven-core/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java
index 500a70ceea..da64fceed7 100644
--- a/maven-core/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java
+++ b/maven-core/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java
@@ -27,8 +27,8 @@ 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.model.Dependency;
-import org.apache.maven.repository.LegacyRepositorySystem;
import org.apache.maven.repository.RepositorySystem;
+import org.apache.maven.repository.legacy.LegacyRepositorySystem;
import org.codehaus.plexus.PlexusTestCase;
/**
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index 970d6740eb..89c04ff59a 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -18,11 +18,8 @@
maven
3.0-SNAPSHOT
-
maven-embedder
-
Maven Embedder
-
org.apache.maven
@@ -67,26 +64,7 @@
commons-cli
commons-cli
-
- org.apache.maven.wagon
- wagon-provider-api
-
-
- org.apache.maven.wagon
- wagon-http-lightweight
- test
-
-
- org.apache.maven.wagon
- wagon-file
- test
-
-
- easymock
- easymock
-
-
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/AbstractConsoleDownloadMonitor.java b/maven-embedder/src/main/java/org/apache/maven/cli/AbstractConsoleDownloadMonitor.java
deleted file mode 100644
index 785b5af0f8..0000000000
--- a/maven-embedder/src/main/java/org/apache/maven/cli/AbstractConsoleDownloadMonitor.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.apache.maven.cli;
-
-/*
- * 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.MavenTransferListener;
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-
-/**
- * Abstract console download progress meter.
- *
- * @author Carlos Sanchez
- * @version $Id$
- * @since 2.0.5
- */
-public abstract class AbstractConsoleDownloadMonitor
- extends AbstractLogEnabled
- implements MavenTransferListener
-{
- private boolean showChecksumEvents = false;
-
- protected boolean showEvent( TransferEvent event )
- {
- if ( event.getResource() == null )
- {
- return true;
- }
-
- String resource = event.getResource().getName();
-
- if ( resource == null || resource.trim().length() == 0 )
- {
- return true;
- }
-
- if ( resource.endsWith( ".sha1" ) || resource.endsWith( ".md5" ) )
- {
- return showChecksumEvents;
- }
-
- return true;
- }
-
- public void transferInitiated( TransferEvent transferEvent )
- {
- if ( !showEvent( transferEvent ) )
- {
- return;
- }
-
- String message = transferEvent.getRequestType() == TransferEvent.REQUEST_PUT ? "Uploading" : "Downloading";
-
- String url = transferEvent.getWagon().getRepository().getUrl();
-
- // TODO: can't use getLogger() because this isn't currently instantiated as a component
- System.out.println( message + ": " + url + "/" + transferEvent.getResource().getName() );
- }
-
- /**
- * Do nothing
- */
- public void transferStarted( TransferEvent transferEvent )
- {
- // This space left intentionally blank
- }
-
- /**
- * Do nothing
- */
- public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length )
- {
- // This space left intentionally blank
- }
-
- public void transferCompleted( TransferEvent transferEvent )
- {
- long contentLength = transferEvent.getResource().getContentLength();
- if ( contentLength != WagonConstants.UNKNOWN_LENGTH )
- {
- String type = ( transferEvent.getRequestType() == TransferEvent.REQUEST_PUT ? "uploaded" : "downloaded" );
- String l = contentLength >= 1024 ? ( contentLength / 1024 ) + "K" : contentLength + "b";
- System.out.println( l + " " + type );
- }
- }
-
- public void transferError( TransferEvent transferEvent )
- {
- // TODO: can't use getLogger() because this isn't currently instantiated as a component
- // transferEvent.getException().printStackTrace();
- }
-
- /**
- * Do nothing
- */
- public void debug( String message )
- {
- // TODO: can't use getLogger() because this isn't currently instantiated as a component
-// getLogger().debug( message );
- }
-
- public boolean isShowChecksumEvents()
- {
- return showChecksumEvents;
- }
-
- public void setShowChecksumEvents( boolean showChecksumEvents )
- {
- this.showChecksumEvents = showChecksumEvents;
- }
-}
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/AbstractMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/AbstractMavenTransferListener.java
new file mode 100644
index 0000000000..622556cd80
--- /dev/null
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/AbstractMavenTransferListener.java
@@ -0,0 +1,80 @@
+package org.apache.maven.cli;
+
+/*
+ * 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;
+
+public abstract class AbstractMavenTransferListener
+ implements ArtifactTransferListener
+{
+ private boolean showChecksumEvents = false;
+
+ protected boolean showEvent( ArtifactTransferEvent event )
+ {
+ if ( event.getResource() == null )
+ {
+ return true;
+ }
+
+ String resource = event.getResource().getName();
+
+ if ( resource == null || resource.trim().length() == 0 )
+ {
+ return true;
+ }
+
+ if ( resource.endsWith( ".sha1" ) || resource.endsWith( ".md5" ) )
+ {
+ return showChecksumEvents;
+ }
+
+ return true;
+ }
+
+ public void transferInitiated( ArtifactTransferEvent transferEvent )
+ {
+ if ( !showEvent( transferEvent ) )
+ {
+ return;
+ }
+ }
+
+ public void transferCompleted( ArtifactTransferEvent transferEvent )
+ {
+ long contentLength = transferEvent.getResource().getContentLength();
+ if ( contentLength != -1 )
+ {
+ String type = ( transferEvent.getRequestType() == ArtifactTransferEvent.REQUEST_PUT ? "uploaded" : "downloaded" );
+ String l = contentLength >= 1024 ? ( contentLength / 1024 ) + "K" : contentLength + "b";
+ System.out.println( l + " " + type );
+ }
+ }
+
+ public boolean isShowChecksumEvents()
+ {
+ return showChecksumEvents;
+ }
+
+ public void setShowChecksumEvents( boolean showChecksumEvents )
+ {
+ this.showChecksumEvents = showChecksumEvents;
+ }
+}
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/BatchModeDownloadMonitor.java b/maven-embedder/src/main/java/org/apache/maven/cli/BatchModeDownloadMonitor.java
deleted file mode 100644
index 7e87b90985..0000000000
--- a/maven-embedder/src/main/java/org/apache/maven/cli/BatchModeDownloadMonitor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.maven.cli;
-
-/*
- * 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.wagon.events.TransferEvent;
-
-/**
- * Console download progress meter.
- *
- * @author Brett Porter
- */
-public class BatchModeDownloadMonitor
- extends AbstractConsoleDownloadMonitor
-{
- public void transferInitiated( TransferEvent transferEvent )
- {
- if ( !showEvent( transferEvent ) )
- {
- return;
- }
-
- String message = transferEvent.getRequestType() == TransferEvent.REQUEST_PUT ? "Uploading" : "Downloading";
-
- String url = transferEvent.getWagon().getRepository().getUrl();
-
- System.out.println( "url = " + url );
-
- // TODO: can't use getLogger() because this isn't currently instantiated as a component
- System.out.println( message + ": " + url + "/" + transferEvent.getResource().getName() );
- }
-}
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/ConsoleDownloadMonitorTest.java b/maven-embedder/src/main/java/org/apache/maven/cli/BatchModeMavenTransferListener.java
similarity index 72%
rename from maven-embedder/src/test/java/org/apache/maven/cli/ConsoleDownloadMonitorTest.java
rename to maven-embedder/src/main/java/org/apache/maven/cli/BatchModeMavenTransferListener.java
index 99239cfc41..937f9ccb43 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/ConsoleDownloadMonitorTest.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/BatchModeMavenTransferListener.java
@@ -19,18 +19,16 @@ package org.apache.maven.cli;
* under the License.
*/
-/**
- * Test for {@link ConsoleDownloadMonitor}
- *
- * @author Carlos Sanchez
- * @version $Id$
- */
-public class ConsoleDownloadMonitorTest
- extends AbstractConsoleDownloadMonitorTest
+import org.apache.maven.repository.ArtifactTransferEvent;
+
+public class BatchModeMavenTransferListener
+ extends AbstractMavenTransferListener
{
- protected void setUp()
- throws Exception
+ public void transferInitiated( ArtifactTransferEvent transferEvent )
{
- monitor = new ConsoleDownloadMonitor();
+ if ( !showEvent( transferEvent ) )
+ {
+ return;
+ }
}
}
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java
index d881638793..f702db9fab 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIRequestUtils.java
@@ -30,8 +30,8 @@ import java.util.Map.Entry;
import org.apache.commons.cli.CommandLine;
import org.apache.maven.Maven;
-import org.apache.maven.MavenTransferListener;
import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.repository.ArtifactTransferListener;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineUtils;
@@ -175,15 +175,15 @@ final class CLIRequestUtils
}
}
- MavenTransferListener transferListener;
+ ArtifactTransferListener transferListener;
if ( request.isInteractiveMode() )
{
- transferListener = new ConsoleDownloadMonitor();
+ transferListener = new ConsoleMavenTransferListener();
}
else
{
- transferListener = new BatchModeDownloadMonitor();
+ transferListener = new BatchModeMavenTransferListener();
}
transferListener.setShowChecksumEvents( false );
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/Configuration.java b/maven-embedder/src/main/java/org/apache/maven/cli/Configuration.java
index 36fdd1b61f..05c9b614a8 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/Configuration.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/Configuration.java
@@ -27,84 +27,13 @@ import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.logging.Logger;
-/**
- * Configuration of embedder, used when starting up.
- *
- * @author mkleint
- * @author Jason van Zyl
- */
public interface Configuration
{
- // ----------------------------------------------------------------------------
- // Settings
- // ----------------------------------------------------------------------------
-
- /** Set location of the userSettingsFile settings file to use for the embedder. */
Configuration setUserSettingsFile( File userSettingsFile );
File getUserSettingsFile();
- /** Set location of the globalSettingsFiles settings file to use for the embedder. */
Configuration setGlobalSettingsFile( File globalSettingsFiles );
File getGlobalSettingsFile();
-
- // ----------------------------------------------------------------------------
- // Logger
- // ----------------------------------------------------------------------------
-
- Configuration setMavenEmbedderLogger( Logger logger );
-
- Logger getMavenEmbedderLogger();
-
- // ----------------------------------------------------------------------------
- // ClassWorld/ClassLoader
- // ----------------------------------------------------------------------------
-
- ClassWorld getClassWorld();
-
- Configuration setClassWorld( ClassWorld classWorld );
-
- Configuration setClassLoader( ClassLoader loader );
-
- PlexusContainer getParentContainer();
-
- Configuration setParentContainer( PlexusContainer parentContainer );
-
- // ----------------------------------------------------------------------------
- // Profiles
- // ----------------------------------------------------------------------------
-
- /** Add profile to activate. */
- Configuration addActiveProfile( String profile );
-
- /** Add profile to inactivate. */
- Configuration addInactiveProfile( String profile );
-
- /** Add a list of String instances with names of profiles to activate. */
- Configuration addActiveProfiles( List profiles );
-
- /** Add a list of String instances with names of profiles to inactivate. */
- Configuration addInactiveProfiles( List profiles );
-
- /** set the system properties to be used during the lifecycle of the embedder. Excluding the time when executing the project, then the properties from MavenExecutionRequestare used. */
- Configuration setSystemProperties( Properties properties );
-
- List getActiveProfiles();
-
- List getInactiveProfiles();
-
- // ----------------------------------------------------------------------------
- // System Properties
- // ----------------------------------------------------------------------------
-
- Properties getSystemProperties();
-
- // ----------------------------------------------------------------------------
- // Extensions
- // ----------------------------------------------------------------------------
-
- void addExtension( URL url );
-
- List getExtensions();
}
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/ConfigurationValidationResult.java b/maven-embedder/src/main/java/org/apache/maven/cli/ConfigurationValidationResult.java
index 454e457fcb..a31b96aebe 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/ConfigurationValidationResult.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/ConfigurationValidationResult.java
@@ -53,49 +53,4 @@ public interface ConfigurationValidationResult
* Any exception that happened during parsing global settings, or null if there were no errors.
*/
Exception getGlobalSettingsException();
-
- /**
- * @deprecated
- */
- boolean isUserSettingsFilePresent();
-
- /**
- * @deprecated
- */
- void setUserSettingsFilePresent( boolean userSettingsFilePresent );
-
- /**
- * @deprecated
- */
- boolean isUserSettingsFileParses();
-
- /**
- * @deprecated
- */
- void setUserSettingsFileParses( boolean userSettingsFileParses );
-
- /**
- * @deprecated
- */
- boolean isGlobalSettingsFilePresent();
-
- /**
- * @deprecated
- */
- void setGlobalSettingsFilePresent( boolean globalSettingsFilePresent );
-
- /**
- * @deprecated
- */
- boolean isGlobalSettingsFileParses();
-
- /**
- * @deprecated
- */
- void setGlobalSettingsFileParses( boolean globalSettingsFileParses );
-
- /**
- * @deprecated
- */
- void display();
}
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/ConsoleDownloadMonitor.java b/maven-embedder/src/main/java/org/apache/maven/cli/ConsoleMavenTransferListener.java
similarity index 72%
rename from maven-embedder/src/main/java/org/apache/maven/cli/ConsoleDownloadMonitor.java
rename to maven-embedder/src/main/java/org/apache/maven/cli/ConsoleMavenTransferListener.java
index f331cba715..a609715735 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/ConsoleDownloadMonitor.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/ConsoleMavenTransferListener.java
@@ -19,27 +19,26 @@ package org.apache.maven.cli;
* under the License.
*/
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.events.TransferEvent;
+import org.apache.maven.repository.ArtifactTransferEvent;
/**
* Console download progress meter.
*
* @author Brett Porter
*/
-public class ConsoleDownloadMonitor
- extends AbstractConsoleDownloadMonitor
+public class ConsoleMavenTransferListener
+ extends AbstractMavenTransferListener
{
private long complete;
- public void transferInitiated( TransferEvent transferEvent )
+ public void transferInitiated( ArtifactTransferEvent transferEvent )
{
super.transferInitiated( transferEvent );
complete = 0;
}
- public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length )
+ public void transferProgress( ArtifactTransferEvent transferEvent, byte[] buffer, int length )
{
long total = transferEvent.getResource().getContentLength();
complete += length;
@@ -53,12 +52,12 @@ public class ConsoleDownloadMonitor
if ( total >= 1024 )
{
System.out.print(
- ( complete / 1024 ) + "/" + ( total == WagonConstants.UNKNOWN_LENGTH ? "?" : ( total / 1024 ) + "K" )
+ ( complete / 1024 ) + "/" + ( total == -1 ? "?" : ( total / 1024 ) + "K" )
+ "\r" );
}
else
{
- System.out.print( complete + "/" + ( total == WagonConstants.UNKNOWN_LENGTH ? "?" : total + "b" ) + "\r" );
+ System.out.print( complete + "/" + ( total == -1 ? "?" : total + "b" ) + "\r" );
}
}
}
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/DefaultConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/DefaultConfiguration.java
index 571e1a5a11..92bfc071ab 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/DefaultConfiguration.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/DefaultConfiguration.java
@@ -19,92 +19,14 @@ package org.apache.maven.cli;
*/
import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.classworlds.ClassWorld;
-import org.codehaus.plexus.logging.Logger;
-
-/**
- * Default implementation of Configuration intefrace.
- *
- * @author mkleint
- */
public class DefaultConfiguration
implements Configuration
{
- private List inactives;
-
- private List actives;
-
private File userSettings;
private File globalSettings;
- private Properties systemProperties;
-
- private List extensions = new ArrayList();
-
- private Logger logger;
-
- private ClassWorld classWorld;
-
- private PlexusContainer parentContainer;
-
- /** Creates a new instance of DefaultConfiguration */
- public DefaultConfiguration()
- {
- }
-
- public Configuration addActiveProfile( String profile )
- {
- getActiveProfiles().add( profile );
-
- return this;
- }
-
- public Configuration addInactiveProfile( String profile )
- {
- getInactiveProfiles().add( profile );
-
- return this;
- }
-
- public Configuration addActiveProfiles( List profiles )
- {
- getActiveProfiles().addAll( profiles );
-
- return this;
- }
-
- public Configuration addInactiveProfiles( List profiles )
- {
- getInactiveProfiles().addAll( profiles );
-
- return this;
- }
-
- public List getActiveProfiles()
- {
- if ( actives == null )
- {
- actives = new ArrayList();
- }
- return actives;
- }
-
- public List getInactiveProfiles()
- {
- if ( inactives == null )
- {
- inactives = new ArrayList();
- }
- return inactives;
- }
-
public Configuration setUserSettingsFile( File user )
{
userSettings = user;
@@ -126,66 +48,4 @@ public class DefaultConfiguration
{
return globalSettings;
}
-
- public Configuration setSystemProperties( Properties properties )
- {
- systemProperties = properties;
- return this;
- }
-
- public Properties getSystemProperties()
- {
- return systemProperties != null ? systemProperties : System.getProperties();
- }
-
- public void addExtension( URL url )
- {
- extensions.add( url );
- }
-
- public List getExtensions()
- {
- return extensions;
- }
-
- public Configuration setMavenEmbedderLogger( Logger logger )
- {
- this.logger = logger;
- return this;
- }
-
- public Logger getMavenEmbedderLogger()
- {
- return logger;
- }
-
- public ClassWorld getClassWorld()
- {
- return classWorld;
- }
-
- public Configuration setClassWorld( ClassWorld classWorld )
- {
- this.classWorld = classWorld;
- return this;
- }
-
- public Configuration setClassLoader( ClassLoader loader )
- {
- classWorld = new ClassWorld( "plexus.core", loader );
-
- return this;
- }
-
- public PlexusContainer getParentContainer()
- {
- return parentContainer;
- }
-
- public Configuration setParentContainer( PlexusContainer parentContainer )
- {
- this.parentContainer = parentContainer;
- return this;
- }
-
}
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/DefaultConfigurationValidationResult.java b/maven-embedder/src/main/java/org/apache/maven/cli/DefaultConfigurationValidationResult.java
index c96785a8ab..12f95c664f 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/DefaultConfigurationValidationResult.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/DefaultConfigurationValidationResult.java
@@ -100,31 +100,6 @@ public class DefaultConfigurationValidationResult
return isSettingsFilePresent( getUserSettings(), getUserSettingsException() );
}
- public void setGlobalSettingsFileParses( boolean globalSettingsFileParses )
- {
- // ignored
- }
-
- public void setGlobalSettingsFilePresent( boolean globalSettingsFilePresent )
- {
- // ignored
- }
-
- public void setUserSettingsFileParses( boolean userSettingsFileParses )
- {
- // ignored
- }
-
- public void setUserSettingsFilePresent( boolean userSettingsFilePresent )
- {
- // ignored
- }
-
- public void display()
- {
- // ignored
- }
-
private boolean isSettingsFilePresent( Settings settings, Throwable e )
{
return ( settings != null ) || ( ( e != null ) && !( e instanceof FileNotFoundException ) );
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 172f0d780d..f0b1e6f85d 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -288,22 +288,6 @@ public class MavenCli
logger.info( "Enabling strict checksum verification on all artifact downloads." );
}
- ConfigurationValidationResult cvr = validateConfiguration( configuration );
-
- if ( cvr.isUserSettingsFilePresent() && !cvr.isUserSettingsFileParses() )
- {
- CLIReportingUtils.showError( logger, "Error reading user settings: ", cvr.getUserSettingsException(), showErrors );
-
- return 1;
- }
-
- if ( cvr.isGlobalSettingsFilePresent() && !cvr.isGlobalSettingsFileParses() )
- {
- CLIReportingUtils.showError( logger, "Error reading global settings: ", cvr.getGlobalSettingsException(), showErrors );
-
- return 1;
- }
-
if ( configuration.getGlobalSettingsFile() != null )
{
request.setGlobalSettingsFile( configuration.getGlobalSettingsFile() );
@@ -452,18 +436,9 @@ public class MavenCli
globalSettingsFile = DEFAULT_GLOBAL_SETTINGS_FILE;
}
- Configuration configuration = new DefaultConfiguration().setUserSettingsFile( userSettingsFile ).setGlobalSettingsFile( globalSettingsFile );
-
- if ( commandLine.hasOption( CLIManager.LOG_FILE ) )
- {
- File logFile = new File( commandLine.getOptionValue( CLIManager.LOG_FILE ) ).getAbsoluteFile();
-
- configuration.setMavenEmbedderLogger( new FileLogger( logFile ) );
- }
- else
- {
- configuration.setMavenEmbedderLogger( new ConsoleLogger( Logger.LEVEL_ERROR, Maven.class.getName()) );
- }
+ Configuration configuration = new DefaultConfiguration()
+ .setUserSettingsFile( userSettingsFile )
+ .setGlobalSettingsFile( globalSettingsFile );
return configuration;
}
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/AbstractConsoleDownloadMonitorTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/AbstractConsoleDownloadMonitorTest.java
deleted file mode 100644
index 0fdf50f3e7..0000000000
--- a/maven-embedder/src/test/java/org/apache/maven/cli/AbstractConsoleDownloadMonitorTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.apache.maven.cli;
-
-/*
- * 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 junit.framework.TestCase;
-
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.providers.file.FileWagon;
-import org.apache.maven.wagon.repository.Repository;
-import org.apache.maven.wagon.resource.Resource;
-
-/**
- * Test for {@link AbstractConsoleDownloadMonitor}
- *
- * @author Carlos Sanchez
- * @version $Id$
- */
-public abstract class AbstractConsoleDownloadMonitorTest
- extends TestCase
-{
- protected AbstractConsoleDownloadMonitor monitor;
-
- public AbstractConsoleDownloadMonitor getMonitor()
- {
- return monitor;
- }
-
- public void testTransferInitiated()
- throws Exception
- {
- monitor.transferInitiated( new TransferEventMock() );
- }
-
- public void testTransferStarted()
- throws Exception
- {
- monitor.transferStarted( new TransferEventMock() );
- }
-
- public void testTransferProgress()
- throws Exception
- {
- byte[] buffer = new byte[1000];
- monitor.transferProgress( new TransferEventMock(), buffer, 1000 );
- }
-
- public void testTransferCompleted()
- throws Exception
- {
- monitor.transferCompleted( new TransferEventMock() );
- }
-
- public void testTransferError()
- throws Exception
- {
- monitor.transferError( new TransferEventMock( new RuntimeException() ) );
- }
-
- public void testDebug()
- throws Exception
- {
- monitor.debug( "msg" );
- }
-
- private class TransferEventMock
- extends TransferEvent
- {
- public TransferEventMock()
- throws ConnectionException, AuthenticationException
- {
- super( new FileWagon(), new Resource(), TransferEvent.TRANSFER_INITIATED, TransferEvent.REQUEST_GET );
- getResource().setContentLength( 100000 );
- Repository repository = new Repository();
- getWagon().connect( repository );
- }
-
- public TransferEventMock( Exception exception )
- throws ConnectionException, AuthenticationException
- {
- super( new FileWagon(), new Resource(), exception, TransferEvent.REQUEST_GET );
- getResource().setContentLength( 100000 );
- Repository repository = new Repository();
- getWagon().connect( repository );
- }
- }
-}
diff --git a/maven-plugin-api/pom.xml b/maven-plugin-api/pom.xml
index f54c68cea3..2f31499496 100644
--- a/maven-plugin-api/pom.xml
+++ b/maven-plugin-api/pom.xml
@@ -37,6 +37,12 @@ under the License.
org.apache.maven
maven-compat
+
+
+ wagon-provider-api
+ org.apache.maven.wagon
+
+
org.codehaus.plexus