From ba289ad502877ac160359e29fe40dc52cba8207c Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Sun, 28 Jun 2009 09:39:49 +0000 Subject: [PATCH] MNG-4221: First phase of changing the direction of the dependencies so that maven-compat only points toward the core. The core cannot depend on anything in maven-compat. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@789077 13f79535-47bb-0310-9956-ffa450edef68 --- maven-compat/pom.xml | 1 - .../artifact/deployer/ArtifactDeployer.java | 64 +- .../deployer/DefaultArtifactDeployer.java | 10 +- .../artifact/factory/ArtifactFactory.java | 2 +- .../artifact/installer/ArtifactInstaller.java | 59 +- .../maven/artifact/manager/WagonManager.java | 99 ---- .../metadata/AbstractArtifactMetadata.java | 41 +- .../artifact/metadata/ArtifactMetadata.java | 63 +- .../ArtifactMetadataRetrievalException.java | 45 +- .../metadata/ArtifactMetadataSource.java | 68 +-- .../artifact/metadata/ResolutionGroup.java | 61 +- .../repository/MavenArtifactRepository.java | 13 - .../metadata/AbstractRepositoryMetadata.java | 7 + .../DefaultRepositoryMetadataManager.java | 4 +- .../metadata/RepositoryMetadata.java | 8 +- .../resolver/ArtifactResolutionException.java | 80 +-- .../resolver/ArtifactResolutionResult.java | 1 + .../artifact/resolver/ArtifactResolver.java | 43 +- .../resolver/DefaultArtifactResolver.java | 22 +- .../AbstractVersionTransformation.java | 2 +- .../execution/ApplicationInformation.java | 26 - .../execution/DefaultRuntimeInformation.java | 110 ---- .../maven/execution/RuntimeInformation.java | 39 -- .../legacy}/ChecksumFailedException.java | 2 +- .../legacy}/DefaultUpdateCheckManager.java | 2 +- .../legacy}/DefaultWagonManager.java | 551 +++++++----------- .../legacy}/UpdateCheckManager.java | 2 +- .../legacy}/WagonConfigurationException.java | 2 +- .../maven/repository/legacy/WagonManager.java | 59 ++ .../metadata/AbstractArtifactMetadata.java | 66 +++ .../legacy/metadata/ArtifactMetadata.java | 84 +++ .../ArtifactMetadataRetrievalException.java | 69 +++ .../metadata/ArtifactMetadataSource.java | 70 +++ .../legacy/metadata/ResolutionGroup.java | 61 ++ .../legacy}/resolver/ArtifactCollector.java | 7 +- .../resolver/DefaultArtifactCollector.java | 14 +- .../resolver/conflict/ConflictResolver.java | 2 +- .../conflict/ConflictResolverFactory.java | 2 +- .../ConflictResolverNotFoundException.java | 2 +- .../conflict/DefaultConflictResolver.java | 2 +- .../DefaultConflictResolverFactory.java | 2 +- .../conflict/FarthestConflictResolver.java | 2 +- .../conflict/NearestConflictResolver.java | 2 +- .../conflict/NewestConflictResolver.java | 2 +- .../conflict/OldestConflictResolver.java | 2 +- .../metadata/ArtifactMetadata.java | 2 +- .../metadata}/ClasspathContainer.java | 5 +- .../metadata}/ClasspathTransformation.java | 3 +- .../DefaultClasspathTransformation.java | 8 +- .../DefaultGraphConflictResolutionPolicy.java | 3 +- .../DefaultGraphConflictResolver.java | 7 +- .../GraphConflictResolutionException.java | 2 +- .../GraphConflictResolutionPolicy.java | 3 +- .../metadata}/GraphConflictResolver.java | 3 +- .../metadata/MetadataGraph.java | 2 +- .../metadata/MetadataGraphEdge.java | 2 +- .../MetadataGraphTransformationException.java | 2 +- .../metadata/MetadataGraphVertex.java | 2 +- .../metadata/MetadataResolution.java | 2 +- .../metadata/MetadataResolutionException.java | 2 +- .../metadata/MetadataResolutionRequest.java | 2 +- .../MetadataResolutionRequestTypeEnum.java | 2 +- .../metadata/MetadataResolutionResult.java | 7 +- .../metadata/MetadataRetrievalException.java | 2 +- .../metadata/MetadataSource.java | 2 +- .../metadata/MetadataTreeNode.java | 2 +- .../SimpleArtifactMetadataSource.java | 6 +- .../resolver/DefaultArtifactResolverTest.java | 1 - .../DefaultUpdateCheckManagerTest.java | 3 +- .../legacy}/DefaultWagonManagerTest.java | 108 +--- .../legacy}/StringWagon.java | 2 +- .../manager => repository/legacy}/WagonA.java | 2 +- .../manager => repository/legacy}/WagonB.java | 2 +- .../manager => repository/legacy}/WagonC.java | 2 +- .../legacy}/WagonMock.java | 2 +- .../DefaultArtifactCollectorTest.java | 6 +- .../AbstractConflictResolverTest.java | 3 +- .../FarthestConflictResolverTest.java | 3 +- .../conflict/NearestConflictResolverTest.java | 3 +- .../conflict/NewestConflictResolverTest.java | 3 +- .../conflict/OldestConflictResolverTest.java | 3 +- .../DefaultClasspathTransformationTest.java | 12 +- ...aultGraphConflictResolutionPolicyTest.java | 5 +- .../DefaultGraphConflictResolverTest.java | 11 +- .../metadata/TestMetadataSource.java | 79 +++ 85 files changed, 956 insertions(+), 1240 deletions(-) delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/execution/ApplicationInformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java rename maven-compat/src/main/java/org/apache/maven/{artifact/manager => repository/legacy}/ChecksumFailedException.java (96%) rename maven-compat/src/main/java/org/apache/maven/{artifact/manager => repository/legacy}/DefaultUpdateCheckManager.java (99%) rename maven-compat/src/main/java/org/apache/maven/{artifact/manager => repository/legacy}/DefaultWagonManager.java (80%) rename maven-compat/src/main/java/org/apache/maven/{artifact/manager => repository/legacy}/UpdateCheckManager.java (97%) rename maven-compat/src/main/java/org/apache/maven/{artifact/manager => repository/legacy}/WagonConfigurationException.java (97%) create mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java create mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java create mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadata.java create mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java create mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java create mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/ArtifactCollector.java (90%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/DefaultArtifactCollector.java (98%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/ConflictResolver.java (96%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/ConflictResolverFactory.java (96%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/ConflictResolverNotFoundException.java (96%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/DefaultConflictResolver.java (95%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/DefaultConflictResolverFactory.java (97%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/FarthestConflictResolver.java (96%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/NearestConflictResolver.java (96%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/NewestConflictResolver.java (97%) rename maven-compat/src/main/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/OldestConflictResolver.java (97%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/ArtifactMetadata.java (99%) rename maven-compat/src/main/java/org/apache/maven/{artifact/transform => repository/metadata}/ClasspathContainer.java (92%) rename maven-compat/src/main/java/org/apache/maven/{artifact/transform => repository/metadata}/ClasspathTransformation.java (89%) rename maven-compat/src/main/java/org/apache/maven/{artifact/transform => repository/metadata}/DefaultClasspathTransformation.java (91%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver/conflict => repository/metadata}/DefaultGraphConflictResolutionPolicy.java (91%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver/conflict => repository/metadata}/DefaultGraphConflictResolver.java (95%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver/conflict => repository/metadata}/GraphConflictResolutionException.java (91%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver/conflict => repository/metadata}/GraphConflictResolutionPolicy.java (77%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver/conflict => repository/metadata}/GraphConflictResolver.java (93%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataGraph.java (99%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataGraphEdge.java (98%) rename maven-compat/src/main/java/org/apache/maven/{artifact/transform => repository/metadata}/MetadataGraphTransformationException.java (92%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataGraphVertex.java (98%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataResolution.java (96%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataResolutionException.java (92%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataResolutionRequest.java (97%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataResolutionRequestTypeEnum.java (88%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataResolutionResult.java (92%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataRetrievalException.java (97%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataSource.java (96%) rename maven-compat/src/main/java/org/apache/maven/{artifact/resolver => repository}/metadata/MetadataTreeNode.java (98%) rename maven-compat/src/test/java/org/apache/maven/{artifact/manager => repository/legacy}/DefaultUpdateCheckManagerTest.java (98%) rename maven-compat/src/test/java/org/apache/maven/{artifact/manager => repository/legacy}/DefaultWagonManagerTest.java (81%) rename maven-compat/src/test/java/org/apache/maven/{artifact/manager => repository/legacy}/StringWagon.java (98%) rename maven-compat/src/test/java/org/apache/maven/{artifact/manager => repository/legacy}/WagonA.java (96%) rename maven-compat/src/test/java/org/apache/maven/{artifact/manager => repository/legacy}/WagonB.java (96%) rename maven-compat/src/test/java/org/apache/maven/{artifact/manager => repository/legacy}/WagonC.java (96%) rename maven-compat/src/test/java/org/apache/maven/{artifact/manager => repository/legacy}/WagonMock.java (97%) rename maven-compat/src/test/java/org/apache/maven/{artifact => repository/legacy}/resolver/DefaultArtifactCollectorTest.java (99%) rename maven-compat/src/test/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/AbstractConflictResolverTest.java (97%) rename maven-compat/src/test/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/FarthestConflictResolverTest.java (95%) rename maven-compat/src/test/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/NearestConflictResolverTest.java (95%) rename maven-compat/src/test/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/NewestConflictResolverTest.java (95%) rename maven-compat/src/test/java/org/apache/maven/{artifact => repository/legacy}/resolver/conflict/OldestConflictResolverTest.java (95%) rename maven-compat/src/test/java/org/apache/maven/{artifact/transform => repository/metadata}/DefaultClasspathTransformationTest.java (90%) rename maven-compat/src/test/java/org/apache/maven/{artifact/resolver/conflict => repository/metadata}/DefaultGraphConflictResolutionPolicyTest.java (88%) rename maven-compat/src/test/java/org/apache/maven/{artifact/resolver/conflict => repository/metadata}/DefaultGraphConflictResolverTest.java (94%) create mode 100644 maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml index ba23bd6c60..c5d129248f 100644 --- a/maven-compat/pom.xml +++ b/maven-compat/pom.xml @@ -20,7 +20,6 @@ maven-compat - Maven Compat diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java index ed7a4dd330..22f2d6c075 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java @@ -1,22 +1,18 @@ package org.apache.maven.artifact.deployer; /* - * 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. + * 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; @@ -29,37 +25,31 @@ public interface ArtifactDeployer String ROLE = ArtifactDeployer.class.getName(); /** - * Deploy an artifact from a particular directory. The artifact handler is used to determine the filename - * of the source file. - * - * @param basedir the directory where the artifact is stored - * @param finalName the name of the artifact sans extension - * @param artifact the artifact definition + * Deploy an artifact from a particular directory. The artifact handler is used to determine the + * filename of the source file. + * + * @param basedir the directory where the artifact is stored + * @param finalName the name of the artifact sans extension + * @param artifact the artifact definition * @param deploymentRepository the repository to deploy to - * @param localRepository the local repository to install into + * @param localRepository the local repository to install into * @throws ArtifactDeploymentException if an error occurred deploying the artifact - * @deprecated to be removed before 2.0 after the instlal/deploy plugins use the alternate method + * @deprecated to be removed before 2.0 after the instlal/deploy plugins use the alternate + * method */ @Deprecated - void deploy( String basedir, - String finalName, - Artifact artifact, - ArtifactRepository deploymentRepository, - ArtifactRepository localRepository ) + void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) throws ArtifactDeploymentException; /** * Deploy an artifact from a particular file. - * - * @param source the file to deploy - * @param artifact the artifact definition + * + * @param source the file to deploy + * @param artifact the artifact definition * @param deploymentRepository the repository to deploy to - * @param localRepository the local repository to install into + * @param localRepository the local repository to install into * @throws ArtifactDeploymentException if an error occurred deploying the artifact */ - void deploy( File source, - Artifact artifact, - ArtifactRepository deploymentRepository, - ArtifactRepository localRepository ) + void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) throws ArtifactDeploymentException; } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java index fd1cdf3f8b..6a70708579 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java @@ -19,14 +19,12 @@ import java.io.File; import java.io.IOException; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataDeploymentException; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager; import org.apache.maven.artifact.transform.ArtifactTransformationManager; +import org.apache.maven.repository.legacy.WagonManager; import org.apache.maven.wagon.TransferFailedException; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; @@ -47,12 +45,6 @@ public class DefaultArtifactDeployer @Requirement private RepositoryMetadataManager repositoryMetadataManager; - @Requirement - private ArtifactMetadataSource metadataSource; - - @Requirement(hint="default") - private ArtifactRepositoryLayout defaultLayout; - /** * @deprecated we want to use the artifact method only, and ensure artifact.file is set * correctly. diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java b/maven-compat/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java index 48012a1fa8..fd8b0640a0 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java @@ -20,9 +20,9 @@ import org.apache.maven.artifact.versioning.VersionRange; public interface ArtifactFactory { + @Deprecated String ROLE = ArtifactFactory.class.getName(); - // TODO: deprecate and chase down (probably used for copying only) Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type ); Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ); diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java b/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java index b3b613e465..f29f66bfe6 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java @@ -1,22 +1,18 @@ package org.apache.maven.artifact.installer; /* - * 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. + * 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; @@ -33,34 +29,29 @@ public interface ArtifactInstaller String ROLE = ArtifactInstaller.class.getName(); /** - * Install an artifact from a particular directory. The artifact handler is used to determine the filename - * of the source file. - * - * @param basedir the directory where the artifact is stored - * @param finalName the name of the artifact sans extension - * @param artifact the artifact definition + * Install an artifact from a particular directory. The artifact handler is used to determine + * the filename of the source file. + * + * @param basedir the directory where the artifact is stored + * @param finalName the name of the artifact sans extension + * @param artifact the artifact definition * @param localRepository the local repository to install into * @throws ArtifactInstallationException if an error occurred installing the artifact - * @deprecated to be removed before 2.0 after the instlal/deploy plugins use the alternate method + * @deprecated to be removed before 2.0 after the instlal/deploy plugins use the alternate + * method */ @Deprecated - void install( String basedir, - String finalName, - Artifact artifact, - ArtifactRepository localRepository ) + void install( String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository ) throws ArtifactInstallationException; - /** * Install an artifact from a particular file. - * - * @param source the file to install - * @param artifact the artifact definition + * + * @param source the file to install + * @param artifact the artifact definition * @param localRepository the local repository to install into * @throws ArtifactInstallationException if an error occurred installing the artifact */ - void install( File source, - Artifact artifact, - ArtifactRepository localRepository ) + void install( File source, Artifact artifact, ArtifactRepository localRepository ) throws ArtifactInstallationException; } 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 deleted file mode 100644 index 9b93189c1c..0000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.apache.maven.artifact.manager; - -/* - * 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.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.UnsupportedProtocolException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.events.TransferListener; -import org.apache.maven.wagon.repository.Repository; - -/** - * Manages Wagon related operations in Maven. - * - * @author Michal Maczka - * @version $Id$ - */ -public interface WagonManager -{ - - void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor, boolean forceUpdateCheck ) - throws TransferFailedException, ResourceDoesNotExistException; - - void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor ) - throws TransferFailedException; - - /** - * Get a Wagon provider that understands the protocol passed as argument. - * It doesn't configure the Wagon. - * - * @param protocol the protocol the {@link Wagon} will handle - * @return the {@link Wagon} instance able to handle the protocol provided - * @throws UnsupportedProtocolException if there is no provider able to handle the protocol - * @deprecated prone to errors. use {@link #getWagon(Repository)} instead. - */ - Wagon getWagon( String protocol ) - throws UnsupportedProtocolException; - - /** - * Get a Wagon provider for the provided repository. - * It will configure the Wagon for that repository. - * - * @param repository the repository - * @return the {@link Wagon} instance that can be used to connect to the repository - * @throws UnsupportedProtocolException if there is no provider able to handle the protocol - * @throws WagonConfigurationException if the wagon can't be configured for the repository - */ - Wagon getWagon( Repository repository ) - throws UnsupportedProtocolException, WagonConfigurationException; - - void getArtifact( Artifact artifact, List remoteRepositories, TransferListener tl, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener tl ) - throws TransferFailedException, ResourceDoesNotExistException; - - void putArtifactMetadata( File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository ) - throws TransferFailedException; - - void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File destination, String checksumPolicy ) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File file, String checksumPolicyWarn ) - throws TransferFailedException, ResourceDoesNotExistException; - - Set getSupportProtocols(); - - void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor, String checksumPolicy, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException; - - void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor ) - throws TransferFailedException; - -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java index bfc0827f28..5ef3a980d8 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java @@ -21,46 +21,13 @@ package org.apache.maven.artifact.metadata; import org.apache.maven.artifact.Artifact; -/** - * Common elements of artifact metadata. - * - * @author Brett Porter - * @version $Id$ - */ +@Deprecated public abstract class AbstractArtifactMetadata - implements ArtifactMetadata + extends org.apache.maven.repository.legacy.metadata.AbstractArtifactMetadata + implements org.apache.maven.artifact.metadata.ArtifactMetadata { - protected Artifact artifact; - protected AbstractArtifactMetadata( Artifact artifact ) { - this.artifact = artifact; - } - - public boolean storedInGroupDirectory() - { - return false; - } - - public String getGroupId() - { - return artifact.getGroupId(); - } - - public String getArtifactId() - { - return artifact.getArtifactId(); - } - - public String extendedToString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append( "\nArtifact Metadata\n--------------------------" ); - buffer.append( "\nGroupId: " ).append( getGroupId() ); - buffer.append( "\nArtifactId: " ).append( getArtifactId() ); - buffer.append( "\nMetadata Type: " ).append( getClass().getName() ); - - return buffer.toString(); + super( artifact ); } } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadata.java index efaab6f340..f73b104900 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadata.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadata.java @@ -19,66 +19,9 @@ package org.apache.maven.artifact.metadata; * under the License. */ -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException; - -/** - * Contains metadata about an artifact, and methods to retrieve/store it from an artifact repository. - * - * @author Brett Porter - * @version $Id$ - * @todo merge with artifactmetadatasource - * @todo retrieval exception not appropriate for store - */ +@Deprecated public interface ArtifactMetadata + extends org.apache.maven.repository.legacy.metadata.ArtifactMetadata { - /** Whether this metadata should be stored alongside the artifact. */ - boolean storedInArtifactVersionDirectory(); - - /** Whether this metadata should be stored alongside the group. */ - boolean storedInGroupDirectory(); - - String getGroupId(); - - String getArtifactId(); - - String getBaseVersion(); - - Object getKey(); - - /** - * Get the filename of this metadata on the local repository. - * - * @param repository the remote repository it came from - * @return the filename - */ - String getLocalFilename( ArtifactRepository repository ); - - /** - * Get the filename of this metadata on the remote repository. - * - * @return the filename - */ - String getRemoteFilename(); - - /** - * Merge a new metadata set into this piece of metadata. - * - * @param metadata the new metadata - * @todo this should only be needed on the repository metadata - */ - void merge( ArtifactMetadata metadata ); - - /** - * Store the metadata in the local repository. - * - * @param localRepository the local repository - * @param remoteRepository the remote repository it came from - * @todo this should only be needed on the repository metadata - */ - void storeInLocalRepository( ArtifactRepository localRepository, - ArtifactRepository remoteRepository ) - throws RepositoryMetadataStoreException; - - String extendedToString(); + void merge( ArtifactMetadata metadata ); } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java index dae720ac42..fb1dffef00 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java @@ -21,49 +21,12 @@ package org.apache.maven.artifact.metadata; import org.apache.maven.artifact.Artifact; -/** - * Error while retrieving repository metadata from the repository. - * - * @author Jason van Zyl - * @version $Id$ - */ +@Deprecated public class ArtifactMetadataRetrievalException - extends Exception + extends org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException { - private Artifact artifact; - - /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */ - @Deprecated - public ArtifactMetadataRetrievalException( String message ) + public ArtifactMetadataRetrievalException( String message, Throwable cause, Artifact artifact ) { - this( message, null, null ); - } - - /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */ - @Deprecated - public ArtifactMetadataRetrievalException( Throwable cause ) - { - this( null, cause, null ); - } - - /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */ - @Deprecated - public ArtifactMetadataRetrievalException( String message, - Throwable cause ) - { - this( message, cause, null ); - } - - public ArtifactMetadataRetrievalException( String message, - Throwable cause, - Artifact artifact ) - { - super( message, cause ); - this.artifact = artifact; - } - - public Artifact getArtifact() - { - return artifact; + super( message, cause, artifact ); } } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java index 2792d9325d..e1f2726615 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java @@ -1,70 +1,36 @@ package org.apache.maven.artifact.metadata; -/* - * 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.util.List; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.versioning.ArtifactVersion; -/** - * Provides some metadata operations, like querying the remote repository for a list of versions available for an - * artifact. - * - * @author Jason van Zyl - * @version $Id$ +/* + * 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. */ + +@Deprecated public interface ArtifactMetadataSource + extends org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource { ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) throws ArtifactMetadataRetrievalException; - /** - * Get a list of available versions for an artifact in the remote repository - * - * @param artifact artifact we are interested in. Only groupid and artifactId - * are needed, for instance the following code will work - * artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" ) - * @param localRepository local repository - * @param remoteRepositories remote repositories, {@link List} $lt; {@link ArtifactRepository} > - * @return {@link List} $lt; {@link ArtifactVersion} > - * @throws ArtifactMetadataRetrievalException - * in case of error while retrieving repository metadata from the repository. - */ List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) throws ArtifactMetadataRetrievalException; - /** - * Get a list of available versions for an artifact in the remote deployment repository. This ignores any update - * policy checks and mirrors and always retrieves the latest information from the given repository. - * - * @param artifact artifact we are interested in. Only groupid and artifactId are - * needed, for instance the following code will work - * artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" ) - * @param localRepository local repository - * @param deploymentRepository remote repository - * @return {@link List} $lt; {@link ArtifactVersion} > - * @throws ArtifactMetadataRetrievalException - * in case of error while retrieving repository metadata from the repository. - */ - List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) + List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) throws ArtifactMetadataRetrievalException; } \ No newline at end of file diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java index a2e8585489..fe5b339da3 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java @@ -1,22 +1,18 @@ package org.apache.maven.artifact.metadata; /* - * 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. + * 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.util.List; @@ -25,37 +21,12 @@ import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; +@Deprecated public class ResolutionGroup + extends org.apache.maven.repository.legacy.metadata.ResolutionGroup { - - private final Set artifacts; - - private final List resolutionRepositories; - - private final Artifact pomArtifact; - - public ResolutionGroup( Artifact pomArtifact, - Set artifacts, - List resolutionRepositories ) + public ResolutionGroup( Artifact pomArtifact, Set artifacts, List resolutionRepositories ) { - this.pomArtifact = pomArtifact; - this.artifacts = artifacts; - this.resolutionRepositories = resolutionRepositories; + super( pomArtifact, artifacts, resolutionRepositories ); } - - public Artifact getPomArtifact() - { - return pomArtifact; - } - - public Set getArtifacts() - { - return artifacts; - } - - public List getResolutionRepositories() - { - return resolutionRepositories; - } - } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java index ea13bb7bea..7f2b399039 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java @@ -43,9 +43,6 @@ public class MavenArtifactRepository private ArtifactRepositoryPolicy snapshots; private ArtifactRepositoryPolicy releases; - - //TODO: this should be tracked externally, not by the repository itself - private boolean blacklisted; public MavenArtifactRepository() { @@ -123,16 +120,6 @@ public class MavenArtifactRepository { return getId(); } - - public boolean isBlacklisted() - { - return blacklisted; - } - - public void setBlacklisted( boolean blacklisted ) - { - this.blacklisted = blacklisted; - } public String toString() { diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java index e2c43c7ca6..1108c2f071 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java @@ -189,6 +189,13 @@ public abstract class AbstractRepositoryMetadata return metadata; } + public void merge( org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata ) + { + // TODO: not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact replaces? + AbstractRepositoryMetadata repoMetadata = (AbstractRepositoryMetadata) metadata; + this.metadata.merge( repoMetadata.getMetadata() ); + } + public void merge( ArtifactMetadata metadata ) { // TODO: not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact replaces? diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java index 625583adff..d2829a3c7a 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java @@ -23,12 +23,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.maven.artifact.manager.UpdateCheckManager; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; +import org.apache.maven.repository.legacy.UpdateCheckManager; +import org.apache.maven.repository.legacy.WagonManager; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; import org.codehaus.plexus.component.annotations.Component; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java index 0eaa7396c1..ee4e79eae8 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java @@ -19,7 +19,7 @@ package org.apache.maven.artifact.repository.metadata; * under the License. */ -import org.apache.maven.artifact.metadata.ArtifactMetadata; +//import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.repository.ArtifactRepository; /** @@ -30,8 +30,8 @@ import org.apache.maven.artifact.repository.ArtifactRepository; * @todo not happy about the store method - they use "this" */ public interface RepositoryMetadata - extends ArtifactMetadata -{ + extends org.apache.maven.artifact.metadata.ArtifactMetadata +{ /** * Set the repository the metadata was located in. * @@ -58,5 +58,5 @@ public interface RepositoryMetadata * * @return if it is a snapshot */ - boolean isSnapshot(); + boolean isSnapshot(); } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java index 06da5ce119..741381fea3 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java @@ -1,31 +1,27 @@ 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. + * 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.IOException; import java.util.List; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; +import org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.wagon.TransferFailedException; /** @@ -35,46 +31,28 @@ import org.apache.maven.wagon.TransferFailedException; public class ArtifactResolutionException extends AbstractArtifactResolutionException { - public ArtifactResolutionException( String message, - String groupId, - String artifactId, - String version, - String type, - String classifier, - List remoteRepositories, - List path, + public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, String classifier, List remoteRepositories, List path, Throwable t ) { super( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, t ); } - public ArtifactResolutionException( String message, - String groupId, - String artifactId, - String version, - String type, - String classifier, - Throwable t ) + public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, String classifier, Throwable t ) { super( message, groupId, artifactId, version, type, classifier, null, null, t ); } - public ArtifactResolutionException( String message, - Artifact artifact ) + public ArtifactResolutionException( String message, Artifact artifact ) { super( message, artifact ); } - public ArtifactResolutionException( String message, - Artifact artifact, - List remoteRepositories ) + public ArtifactResolutionException( String message, Artifact artifact, List remoteRepositories ) { super( message, artifact, remoteRepositories ); } - public ArtifactResolutionException( String message, - Artifact artifact, - ArtifactMetadataRetrievalException cause ) + public ArtifactResolutionException( String message, Artifact artifact, ArtifactMetadataRetrievalException cause ) { super( message, artifact, null, cause ); } @@ -85,40 +63,28 @@ public class ArtifactResolutionException super( message, artifact, null, cause ); } - protected ArtifactResolutionException( String message, - Artifact artifact, - List remoteRepositories, - ArtifactMetadataRetrievalException cause ) + public ArtifactResolutionException( String message, Artifact artifact, List remoteRepositories, ArtifactMetadataRetrievalException cause ) { super( message, artifact, remoteRepositories, cause ); } @Deprecated - protected ArtifactResolutionException( String message, Artifact artifact, - List remoteRepositories, Throwable cause ) + protected ArtifactResolutionException( String message, Artifact artifact, List remoteRepositories, Throwable cause ) { super( message, artifact, remoteRepositories, cause ); } - protected ArtifactResolutionException( String message, - Artifact artifact, - List remoteRepositories, - TransferFailedException cause ) + protected ArtifactResolutionException( String message, Artifact artifact, List remoteRepositories, TransferFailedException cause ) { super( message, artifact, remoteRepositories, cause ); } - protected ArtifactResolutionException( String message, - Artifact artifact, - List remoteRepositories, - IOException cause ) + protected ArtifactResolutionException( String message, Artifact artifact, List remoteRepositories, IOException cause ) { super( message, artifact, remoteRepositories, cause ); } - public ArtifactResolutionException( String message, - Artifact artifact, - RepositoryMetadataResolutionException cause ) + public ArtifactResolutionException( String message, Artifact artifact, RepositoryMetadataResolutionException cause ) { super( message, artifact, null, cause ); } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java index 1f6854b028..2d04533c3f 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java @@ -24,6 +24,7 @@ import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.versioning.OverConstrainedVersionException; +import org.apache.maven.repository.legacy.resolver.DefaultArtifactCollector; /** * Specific problems during resolution that we want to account for: diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java index eeace72170..d732439da6 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java @@ -11,51 +11,44 @@ import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.wagon.events.TransferListener; /* - * 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. + * 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. */ /** * @author Jason van Zyl */ +// Just hide the one method we want behind the RepositorySystem interface. public interface ArtifactResolver { ArtifactResolutionResult resolve( ArtifactResolutionRequest request ); // The rest is deprecated - + // USED BY MAVEN ASSEMBLY PLUGIN 2.2-beta-2 @Deprecated String ROLE = ArtifactResolver.class.getName(); // USED BY SUREFIRE @Deprecated - ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, - ArtifactRepository localRepository, - List remoteRepositories, + ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY MAVEN ASSEMBLY PLUGIN @Deprecated - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY REMOTE RESOURCES PLUGIN @@ -71,5 +64,5 @@ public interface ArtifactResolver // USED BY ARCHETYPE DOWNLOADER @Deprecated void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) - throws ArtifactResolutionException, ArtifactNotFoundException; + throws ArtifactResolutionException, ArtifactNotFoundException; } 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 e504b332b2..595dde1cad 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 @@ -27,8 +27,6 @@ import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.manager.WagonManager; -import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.ArtifactRepository; @@ -36,9 +34,12 @@ import org.apache.maven.artifact.repository.metadata.Metadata; import org.apache.maven.artifact.repository.metadata.Snapshot; import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.resolver.conflict.ConflictResolver; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.transform.ArtifactTransformationManager; +import org.apache.maven.repository.legacy.WagonManager; +import org.apache.maven.repository.legacy.metadata.ArtifactMetadata; +import org.apache.maven.repository.legacy.resolver.ArtifactCollector; +import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.events.TransferListener; @@ -146,10 +147,6 @@ public class DefaultArtifactResolver return; } - //String localPath = localRepository.pathOf( artifact ); - - //artifact.setFile( new File( localRepository.getBasedir(), localPath ) ); - transformationManager.transformForResolve( artifact, remoteRepositories, localRepository ); boolean localCopy = isLocalCopy( artifact ); @@ -158,13 +155,6 @@ 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) - // 3. the artifact is a snapshot and is not a locally installed snapshot - if ( force || !destination.exists() || ( artifact.isSnapshot() && !localCopy ) ) { try @@ -172,11 +162,11 @@ public class DefaultArtifactResolver if ( artifact.getRepository() != null ) { // the transformations discovered the artifact - so use it exclusively - wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor, force ); + wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor ); } else { - wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor, force ); + wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor ); } if ( !artifact.isResolved() && !destination.exists() ) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/transform/AbstractVersionTransformation.java b/maven-compat/src/main/java/org/apache/maven/artifact/transform/AbstractVersionTransformation.java index 7ce62d4c1e..8946363b65 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/transform/AbstractVersionTransformation.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/transform/AbstractVersionTransformation.java @@ -22,7 +22,6 @@ package org.apache.maven.artifact.transform; import java.util.List; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; import org.apache.maven.artifact.repository.metadata.Metadata; @@ -31,6 +30,7 @@ import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; import org.apache.maven.artifact.repository.metadata.Versioning; +import org.apache.maven.repository.legacy.WagonManager; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.AbstractLogEnabled; diff --git a/maven-compat/src/main/java/org/apache/maven/execution/ApplicationInformation.java b/maven-compat/src/main/java/org/apache/maven/execution/ApplicationInformation.java deleted file mode 100644 index d68f1ee350..0000000000 --- a/maven-compat/src/main/java/org/apache/maven/execution/ApplicationInformation.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.apache.maven.execution; - -import org.apache.maven.artifact.versioning.ArtifactVersion; - -@Deprecated -public class ApplicationInformation -{ - private ArtifactVersion version; - private String builtOn; - - public ApplicationInformation( ArtifactVersion version, String builtOn ) - { - this.version = version; - this.builtOn = builtOn; - } - - public ArtifactVersion getVersion() - { - return version; - } - - public String getBuiltOn() - { - return builtOn; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java b/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java deleted file mode 100644 index 5272d29bf6..0000000000 --- a/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.apache.maven.execution; - -/* - * 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.IOException; -import java.io.InputStream; -import java.util.Properties; - -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; -import org.codehaus.plexus.util.IOUtil; - -/** - * Describes runtime information about the application. - * - * @author Jason van Zyl - * @author Brett Porter - * @version $Id$ - */ -@Deprecated -@Component(role = RuntimeInformation.class) -public class DefaultRuntimeInformation - implements RuntimeInformation, Initializable -{ - private ApplicationInformation applicationInformation; - - public ApplicationInformation getApplicationInformation() - { - return applicationInformation; - } - - /** @deprecated Use getApplicationInformation() */ - public ArtifactVersion getApplicationVersion() - { - return applicationInformation.getVersion(); - } - - public void initialize() - throws InitializationException - { - applicationInformation = getVersion( getClass().getClassLoader(), "org.apache.maven", "maven-core" ); - } - - public static ApplicationInformation getVersion( ClassLoader loader, String groupId, String artifactId ) - { - String MAVEN_PROPERTIES = "META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties"; - - String version = "unknown"; - String builtOn = "unknown"; - - InputStream resourceAsStream = null; - try - { - Properties properties = new Properties(); - resourceAsStream = loader.getResourceAsStream( MAVEN_PROPERTIES ); - - if ( resourceAsStream == null ) - { - return new ApplicationInformation( new DefaultArtifactVersion( "3.0" ), builtOn ); - } - - properties.load( resourceAsStream ); - - String property = properties.getProperty( "version" ); - - if ( property != null ) - { - version = property; - } - - property = properties.getProperty( "builtOn" ); - - if ( property != null ) - { - builtOn = property; - } - - return new ApplicationInformation( new DefaultArtifactVersion( version ), builtOn ); - - } - catch ( IOException e ) - { - return new ApplicationInformation( new DefaultArtifactVersion( version ), builtOn ); - } - finally - { - IOUtil.close( resourceAsStream ); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java b/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java deleted file mode 100644 index 01964ab492..0000000000 --- a/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.execution; - -import org.apache.maven.artifact.versioning.ArtifactVersion; - -/* - * 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. - */ - -/** - * Describes runtime information about the application. - * - * @author Brett Porter - * @version $Id$ - */ -@Deprecated -public interface RuntimeInformation -{ - ApplicationInformation getApplicationInformation(); - - /** @deprecated Use getApplicationInformation() */ - //!!BC Used by the Eclipse Plugin - ArtifactVersion getApplicationVersion(); - -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/ChecksumFailedException.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java similarity index 96% rename from maven-compat/src/main/java/org/apache/maven/artifact/manager/ChecksumFailedException.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java index dbac171ca0..0a98d3cd94 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/ChecksumFailedException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultUpdateCheckManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java similarity index 99% rename from maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultUpdateCheckManager.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java index 612a6c3c43..189346b4a9 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultUpdateCheckManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java similarity index 80% rename from maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java index a5c872b7bb..138354beef 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; /* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license @@ -17,13 +17,10 @@ package org.apache.maven.artifact.manager; import java.io.File; import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; 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; @@ -42,15 +39,13 @@ import org.apache.maven.wagon.repository.Repository; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.component.configurator.BasicComponentConfigurator; -import org.codehaus.plexus.component.configurator.ComponentConfigurationException; -import org.codehaus.plexus.component.configurator.ComponentConfigurator; import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException; -import org.codehaus.plexus.configuration.PlexusConfiguration; -import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.FileUtils; +//TODO: remove the update check manager +//TODO: separate into retriever and publisher +//TODO: rmeove hardcoding of checksum logic @Component(role = WagonManager.class) public class DefaultWagonManager implements WagonManager @@ -66,278 +61,33 @@ public class DefaultWagonManager @Requirement private PlexusContainer container; - /** Map( String, XmlPlexusConfiguration ) with the repository id and the wagon configuration */ - private Map serverConfigurationMap = new HashMap(); - @Requirement(role = Wagon.class) - private Map wagons; + private Map wagons; @Requirement private UpdateCheckManager updateCheckManager; - private String httpUserAgent = "Apache-Maven/3.0-alpha-1"; - - private TransferListener downloadMonitor; - - public void setDownloadMonitor( TransferListener downloadMonitor ) - { - this.downloadMonitor = downloadMonitor; - } - - public Wagon getWagon( Repository repository ) - throws UnsupportedProtocolException, WagonConfigurationException - { - String protocol = repository.getProtocol(); - - if ( protocol == null ) - { - throw new UnsupportedProtocolException( "The repository " + repository + " does not specify a protocol" ); - } - - Wagon wagon = getWagon( protocol ); - - configureWagon( wagon, repository.getId(), protocol ); - - return wagon; - } - - public Wagon getWagon( String protocol ) - throws UnsupportedProtocolException - { - if ( protocol == null ) - { - throw new UnsupportedProtocolException( "Unspecified protocol" ); - } - - String hint = protocol.toLowerCase( java.util.Locale.ENGLISH ); - Wagon wagon = (Wagon) wagons.get( hint ); - - if ( wagon == null ) - { - throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: " + protocol ); - } - - return wagon; - } - - public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository ) - throws TransferFailedException - { - putRemoteFile( deploymentRepository, source, deploymentRepository.pathOf( artifact ), downloadMonitor ); - } - - public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor ) - throws TransferFailedException - { - putRemoteFile( deploymentRepository, source, deploymentRepository.pathOf( artifact ), downloadMonitor ); - } - - public void putArtifactMetadata( File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository ) - throws TransferFailedException - { - logger.info( "Uploading " + artifactMetadata ); - putRemoteFile( repository, source, repository.pathOfRemoteRepositoryMetadata( artifactMetadata ), null ); - } - - public void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor ) - throws TransferFailedException - { - String protocol = repository.getProtocol(); - - Wagon wagon; - try - { - wagon = getWagon( protocol ); - - configureWagon( wagon, repository ); - } - catch ( UnsupportedProtocolException e ) - { - throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e ); - } - - if ( downloadMonitor != null ) - { - wagon.addTransferListener( downloadMonitor ); - } - - Map checksums = new HashMap( 2 ); - - Map sums = new HashMap( 2 ); - - // TODO: configure these on the repository - for ( int i = 0; i < CHECKSUM_IDS.length; i++ ) - { - checksums.put( CHECKSUM_IDS[i], addChecksumObserver( wagon, CHECKSUM_ALGORITHMS[i] ) ); - } - - try - { - try - { - wagon.connect( new Repository( repository.getId(), repository.getUrl() ) ); - - wagon.put( source, remotePath ); - } - finally - { - if ( downloadMonitor != null ) - { - wagon.removeTransferListener( downloadMonitor ); - } - } - - // Pre-store the checksums as any future puts will overwrite them - for ( String extension : checksums.keySet() ) - { - ChecksumObserver observer = checksums.get( extension ); - sums.put( extension, observer.getActualChecksum() ); - } - - // We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself - for ( String extension : checksums.keySet() ) - { - // TODO: shouldn't need a file intermediatary - improve wagon to take a stream - File temp = File.createTempFile( "maven-artifact", null ); - temp.deleteOnExit(); - FileUtils.fileWrite( temp.getAbsolutePath(), "UTF-8", sums.get( extension ) ); - - wagon.put( temp, remotePath + "." + extension ); - } - } - catch ( ConnectionException e ) - { - throw new TransferFailedException( "Connection failed: " + e.getMessage(), e ); - } - catch ( AuthenticationException e ) - { - throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e ); - } - catch ( AuthorizationException e ) - { - throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e ); - } - catch ( ResourceDoesNotExistException e ) - { - throw new TransferFailedException( "Resource to deploy not found: " + e.getMessage(), e ); - } - catch ( IOException e ) - { - throw new TransferFailedException( "Error creating temporary file for deployment: " + e.getMessage(), e ); - } - finally - { - // Remove every checksum listener - for ( String aCHECKSUM_IDS : CHECKSUM_IDS ) - { - TransferListener checksumListener = checksums.get( aCHECKSUM_IDS ); - if ( checksumListener != null ) - { - wagon.removeTransferListener( checksumListener ); - } - } - - disconnectWagon( wagon ); - - releaseWagon( protocol, wagon ); - } - } - - private ChecksumObserver addChecksumObserver( Wagon wagon, String algorithm ) - throws TransferFailedException - { - try - { - ChecksumObserver checksumObserver = new ChecksumObserver( algorithm ); - wagon.addTransferListener( checksumObserver ); - return checksumObserver; - } - catch ( NoSuchAlgorithmException e ) - { - throw new TransferFailedException( "Unable to add checksum for unsupported algorithm " + algorithm, e ); - } - } - - // NOTE: It is not possible that this method throws TransferFailedException under current conditions. - // FIXME: Change the throws clause to reflect the fact that we're never throwing TransferFailedException - public void getArtifact( Artifact artifact, ArtifactRepository remoteRepository, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException - { - getArtifact( artifact, remoteRepository, downloadMonitor, force ); - } - - public void getArtifact( Artifact artifact, ArtifactRepository remoteRepository ) - throws TransferFailedException, ResourceDoesNotExistException - { - getArtifact( artifact, remoteRepository, downloadMonitor, true ); - } - - public void getArtifact( Artifact artifact, List remoteRepositories, TransferListener downloadMonitor ) - throws TransferFailedException, ResourceDoesNotExistException - { - getArtifact( artifact, remoteRepositories, downloadMonitor, true ); - } - - public void getArtifact( Artifact artifact, List remoteRepositories, TransferListener downloadMonitor, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException - { - for ( ArtifactRepository repository : remoteRepositories ) - { - try - { - getArtifact( artifact, repository, downloadMonitor, force ); - - if ( artifact.isResolved() ) - { - break; - } - } - catch ( ResourceDoesNotExistException e ) - { - // This one we will eat when looking through remote repositories - // because we want to cycle through them all before squawking. - - logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId() + " (" + repository.getUrl() + ")", e ); - } - catch ( TransferFailedException e ) - { - logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId() + " (" + repository.getUrl() + ")", e ); - } - } - - // if it already exists locally we were just trying to force it - ignore the update - if ( !artifact.getFile().exists() ) - { - throw new ResourceDoesNotExistException( "Unable to download the artifact from any repository" ); - } - } - + // + // Retriever + // public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor ) throws TransferFailedException, ResourceDoesNotExistException - { - getArtifact( artifact, repository, downloadMonitor, true ); - } - - //TODO: all of this needs to move into the repository system - - public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException { String remotePath = repository.pathOf( artifact ); - + ArtifactRepositoryPolicy policy = artifact.isSnapshot() ? repository.getSnapshots() : repository.getReleases(); - + boolean updateCheckIsRequired = updateCheckManager.isUpdateRequired( artifact, repository ); - + if ( !policy.isEnabled() ) - { + { logger.debug( "Skipping disabled repository " + repository.getId() ); } - + // If the artifact is a snapshot, we need to determine whether it's time to check this repository for an update: // 1. If it's forced, then check // 2. If the updateInterval has been exceeded since the last check for this artifact on this repository, then check. - else if ( artifact.isSnapshot() && ( force || updateCheckIsRequired ) ) + else if ( artifact.isSnapshot() && updateCheckIsRequired ) { logger.debug( "Trying repository " + repository.getId() ); @@ -362,7 +112,7 @@ public class DefaultWagonManager else if ( "pom".equals( artifact.getType() ) && !artifact.getFile().exists() ) { // if POM is not present locally, try and get it if it's forced, out of date, or has not been attempted yet - if ( force || updateCheckManager.isPomUpdateRequired( artifact, repository ) ) + if ( updateCheckManager.isPomUpdateRequired( artifact, repository ) ) { logger.debug( "Trying repository " + repository.getId() ); @@ -408,6 +158,40 @@ public class DefaultWagonManager } } + public void getArtifact( Artifact artifact, List remoteRepositories, TransferListener downloadMonitor ) + throws TransferFailedException, ResourceDoesNotExistException + { + for ( ArtifactRepository repository : remoteRepositories ) + { + try + { + getArtifact( artifact, repository, downloadMonitor ); + + if ( artifact.isResolved() ) + { + break; + } + } + catch ( ResourceDoesNotExistException e ) + { + // This one we will eat when looking through remote repositories + // because we want to cycle through them all before squawking. + + logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId() + " (" + repository.getUrl() + ")", e ); + } + catch ( TransferFailedException e ) + { + logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId() + " (" + repository.getUrl() + ")", e ); + } + } + + // if it already exists locally we were just trying to force it - ignore the update + if ( !artifact.getFile().exists() ) + { + throw new ResourceDoesNotExistException( "Unable to download the artifact from any repository" ); + } + } + public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy ) throws TransferFailedException, ResourceDoesNotExistException { @@ -428,20 +212,18 @@ public class DefaultWagonManager throws TransferFailedException, ResourceDoesNotExistException { String protocol = repository.getProtocol(); - + Wagon wagon; try { wagon = getWagon( protocol ); - - configureWagon( wagon, repository ); } catch ( UnsupportedProtocolException e ) { throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e ); } - + if ( downloadMonitor != null ) { wagon.addTransferListener( downloadMonitor ); @@ -454,7 +236,7 @@ public class DefaultWagonManager boolean downloaded = false; try - { + { wagon.connect( new Repository( repository.getId(), repository.getUrl() ) ); boolean firstRun = true; @@ -635,6 +417,139 @@ public class DefaultWagonManager } } + // + // Publisher + // + public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor ) + throws TransferFailedException + { + putRemoteFile( deploymentRepository, source, deploymentRepository.pathOf( artifact ), downloadMonitor ); + } + + public void putArtifactMetadata( File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository ) + throws TransferFailedException + { + logger.info( "Uploading " + artifactMetadata ); + putRemoteFile( repository, source, repository.pathOfRemoteRepositoryMetadata( artifactMetadata ), null ); + } + + public void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor ) + throws TransferFailedException + { + String protocol = repository.getProtocol(); + + Wagon wagon; + try + { + wagon = getWagon( protocol ); + } + catch ( UnsupportedProtocolException e ) + { + throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e ); + } + + if ( downloadMonitor != null ) + { + wagon.addTransferListener( downloadMonitor ); + } + + Map checksums = new HashMap( 2 ); + + Map sums = new HashMap( 2 ); + + // TODO: configure these on the repository + for ( int i = 0; i < CHECKSUM_IDS.length; i++ ) + { + checksums.put( CHECKSUM_IDS[i], addChecksumObserver( wagon, CHECKSUM_ALGORITHMS[i] ) ); + } + + try + { + try + { + wagon.connect( new Repository( repository.getId(), repository.getUrl() ) ); + + wagon.put( source, remotePath ); + } + finally + { + if ( downloadMonitor != null ) + { + wagon.removeTransferListener( downloadMonitor ); + } + } + + // Pre-store the checksums as any future puts will overwrite them + for ( String extension : checksums.keySet() ) + { + ChecksumObserver observer = checksums.get( extension ); + sums.put( extension, observer.getActualChecksum() ); + } + + // We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself + for ( String extension : checksums.keySet() ) + { + // TODO: shouldn't need a file intermediatary - improve wagon to take a stream + File temp = File.createTempFile( "maven-artifact", null ); + temp.deleteOnExit(); + FileUtils.fileWrite( temp.getAbsolutePath(), "UTF-8", sums.get( extension ) ); + + wagon.put( temp, remotePath + "." + extension ); + } + } + catch ( ConnectionException e ) + { + throw new TransferFailedException( "Connection failed: " + e.getMessage(), e ); + } + catch ( AuthenticationException e ) + { + throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e ); + } + catch ( AuthorizationException e ) + { + throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e ); + } + catch ( ResourceDoesNotExistException e ) + { + throw new TransferFailedException( "Resource to deploy not found: " + e.getMessage(), e ); + } + catch ( IOException e ) + { + throw new TransferFailedException( "Error creating temporary file for deployment: " + e.getMessage(), e ); + } + finally + { + // Remove every checksum listener + for ( String aCHECKSUM_IDS : CHECKSUM_IDS ) + { + TransferListener checksumListener = checksums.get( aCHECKSUM_IDS ); + if ( checksumListener != null ) + { + wagon.removeTransferListener( checksumListener ); + } + } + + disconnectWagon( wagon ); + + releaseWagon( protocol, wagon ); + } + } + + private ChecksumObserver addChecksumObserver( Wagon wagon, String algorithm ) + throws TransferFailedException + { + try + { + ChecksumObserver checksumObserver = new ChecksumObserver( algorithm ); + wagon.addTransferListener( checksumObserver ); + return checksumObserver; + } + catch ( NoSuchAlgorithmException e ) + { + throw new TransferFailedException( "Unable to add checksum for unsupported algorithm " + algorithm, e ); + } + } + private void handleChecksumFailure( String checksumPolicy, String message, Throwable cause ) throws ChecksumFailedException { @@ -729,95 +644,23 @@ public class DefaultWagonManager } } - /** - * Checks the URL to see if this repository refers to an external repository - * - * @param originalRepository - * @return true if external. - */ - public boolean isExternalRepo( ArtifactRepository originalRepository ) + @Deprecated + public Wagon getWagon( String protocol ) + throws UnsupportedProtocolException { - try + if ( protocol == null ) { - URL url = new URL( originalRepository.getUrl() ); - return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) || url.getProtocol().equals( "file" ) ); + throw new UnsupportedProtocolException( "Unspecified protocol" ); } - catch ( MalformedURLException e ) + + String hint = protocol.toLowerCase( java.util.Locale.ENGLISH ); + Wagon wagon = (Wagon) wagons.get( hint ); + + if ( wagon == null ) { - // bad url just skip it here. It should have been validated already, but the wagon lookup will deal with it - return false; + throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: " + protocol ); } - } - - /** - * Applies the server configuration to the wagon - * - * @param wagon the wagon to configure - * @param repository the repository that has the configuration - * @throws WagonConfigurationException wraps any error given during configuration of the wagon - * instance - */ - private void configureWagon( Wagon wagon, ArtifactRepository repository ) - throws WagonConfigurationException - { - configureWagon( wagon, repository.getId(), repository.getProtocol() ); - } - private void configureWagon( Wagon wagon, String repositoryId, String protocol ) - throws WagonConfigurationException - { - PlexusConfiguration config = (PlexusConfiguration) serverConfigurationMap.get( repositoryId ); - - if ( config != null ) - { - ComponentConfigurator componentConfigurator = null; - - try - { - componentConfigurator = new BasicComponentConfigurator(); - - componentConfigurator.configureComponent( wagon, config, container.getContainerRealm() ); - } - catch ( ComponentConfigurationException e ) - { - throw new WagonConfigurationException( repositoryId, "Unable to apply wagon configuration.", e ); - } - finally - { - if ( componentConfigurator != null ) - { - try - { - container.release( componentConfigurator ); - } - catch ( ComponentLifecycleException e ) - { - logger.error( "Problem releasing configurator - ignoring: " + e.getMessage() ); - } - } - - } - } - } - - /** - * {@inheritDoc} - */ - public void setHttpUserAgent( String userAgent ) - { - this.httpUserAgent = userAgent; - } - - /** - * {@inheritDoc} - */ - public String getHttpUserAgent() - { - return httpUserAgent; - } - - public Set getSupportProtocols() - { - return wagons.keySet(); + return wagon; } } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/UpdateCheckManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java similarity index 97% rename from maven-compat/src/main/java/org/apache/maven/artifact/manager/UpdateCheckManager.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java index 015d1d3514..b21aebf9b5 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/UpdateCheckManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java similarity index 97% rename from maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java index 43a51d7eac..078de00c5e 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; /* * Licensed to the Apache Software Foundation (ASF) under one 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 new file mode 100644 index 0000000000..355909f6dc --- /dev/null +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java @@ -0,0 +1,59 @@ +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 java.io.File; +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.wagon.ResourceDoesNotExistException; +import org.apache.maven.wagon.TransferFailedException; +import org.apache.maven.wagon.events.TransferListener; + +public interface WagonManager +{ + // + // Retriever + // + void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener transferListener ) + throws TransferFailedException, ResourceDoesNotExistException; + + void getArtifact( Artifact artifact, List remoteRepositories, TransferListener transferListener ) + throws TransferFailedException, ResourceDoesNotExistException; + + void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor, String checksumPolicy, boolean force ) + throws TransferFailedException, ResourceDoesNotExistException; + + void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File destination, String checksumPolicy ) + throws TransferFailedException, ResourceDoesNotExistException; + + void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File file, String checksumPolicyWarn ) + throws TransferFailedException, ResourceDoesNotExistException; + + // + // Deployer + // + void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor ) + throws TransferFailedException; + + void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor ) + throws TransferFailedException; + + void putArtifactMetadata( File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository ) + throws TransferFailedException; +} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java new file mode 100644 index 0000000000..66f513d938 --- /dev/null +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java @@ -0,0 +1,66 @@ +package org.apache.maven.repository.legacy.metadata; + +/* + * 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.artifact.Artifact; + +/** + * Common elements of artifact metadata. + * + * @author Brett Porter + * @version $Id$ + */ +public abstract class AbstractArtifactMetadata + implements ArtifactMetadata +{ + protected Artifact artifact; + + protected AbstractArtifactMetadata( Artifact artifact ) + { + this.artifact = artifact; + } + + public boolean storedInGroupDirectory() + { + return false; + } + + public String getGroupId() + { + return artifact.getGroupId(); + } + + public String getArtifactId() + { + return artifact.getArtifactId(); + } + + public String extendedToString() + { + StringBuffer buffer = new StringBuffer(); + + buffer.append( "\nArtifact Metadata\n--------------------------" ); + buffer.append( "\nGroupId: " ).append( getGroupId() ); + buffer.append( "\nArtifactId: " ).append( getArtifactId() ); + buffer.append( "\nMetadata Type: " ).append( getClass().getName() ); + + return buffer.toString(); + } +} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadata.java new file mode 100644 index 0000000000..43ca92e83f --- /dev/null +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadata.java @@ -0,0 +1,84 @@ +package org.apache.maven.repository.legacy.metadata; + +/* + * 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.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException; + +/** + * Contains metadata about an artifact, and methods to retrieve/store it from an artifact repository. + * + * @author Brett Porter + * @version $Id$ + * @todo merge with artifactmetadatasource + * @todo retrieval exception not appropriate for store + */ +public interface ArtifactMetadata +{ + /** Whether this metadata should be stored alongside the artifact. */ + boolean storedInArtifactVersionDirectory(); + + /** Whether this metadata should be stored alongside the group. */ + boolean storedInGroupDirectory(); + + String getGroupId(); + + String getArtifactId(); + + String getBaseVersion(); + + Object getKey(); + + /** + * Get the filename of this metadata on the local repository. + * + * @param repository the remote repository it came from + * @return the filename + */ + String getLocalFilename( ArtifactRepository repository ); + + /** + * Get the filename of this metadata on the remote repository. + * + * @return the filename + */ + String getRemoteFilename(); + + /** + * Merge a new metadata set into this piece of metadata. + * + * @param metadata the new metadata + * @todo this should only be needed on the repository metadata + */ + void merge( ArtifactMetadata metadata ); + + /** + * Store the metadata in the local repository. + * + * @param localRepository the local repository + * @param remoteRepository the remote repository it came from + * @todo this should only be needed on the repository metadata + */ + void storeInLocalRepository( ArtifactRepository localRepository, + ArtifactRepository remoteRepository ) + throws RepositoryMetadataStoreException; + + String extendedToString(); +} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java new file mode 100644 index 0000000000..1a94b9a495 --- /dev/null +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java @@ -0,0 +1,69 @@ +package org.apache.maven.repository.legacy.metadata; + +/* + * 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.artifact.Artifact; + +/** + * Error while retrieving repository metadata from the repository. + * + * @author Jason van Zyl + * @version $Id$ + */ +public class ArtifactMetadataRetrievalException + extends Exception +{ + private Artifact artifact; + + /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */ + @Deprecated + public ArtifactMetadataRetrievalException( String message ) + { + this( message, null, null ); + } + + /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */ + @Deprecated + public ArtifactMetadataRetrievalException( Throwable cause ) + { + this( null, cause, null ); + } + + /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */ + @Deprecated + public ArtifactMetadataRetrievalException( String message, + Throwable cause ) + { + this( message, cause, null ); + } + + public ArtifactMetadataRetrievalException( String message, + Throwable cause, + Artifact artifact ) + { + super( message, cause ); + this.artifact = artifact; + } + + public Artifact getArtifact() + { + return artifact; + } +} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java new file mode 100644 index 0000000000..5e0477a017 --- /dev/null +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java @@ -0,0 +1,70 @@ +package org.apache.maven.repository.legacy.metadata; + +/* + * 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.util.List; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.versioning.ArtifactVersion; + +/** + * Provides some metadata operations, like querying the remote repository for a list of versions available for an + * artifact. + * + * @author Jason van Zyl + * @version $Id$ + */ +public interface ArtifactMetadataSource +{ + ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + throws ArtifactMetadataRetrievalException; + + /** + * Get a list of available versions for an artifact in the remote repository + * + * @param artifact artifact we are interested in. Only groupid and artifactId + * are needed, for instance the following code will work + * artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" ) + * @param localRepository local repository + * @param remoteRepositories remote repositories, {@link List} $lt; {@link ArtifactRepository} > + * @return {@link List} $lt; {@link ArtifactVersion} > + * @throws ArtifactMetadataRetrievalException + * in case of error while retrieving repository metadata from the repository. + */ + List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + throws ArtifactMetadataRetrievalException; + + /** + * Get a list of available versions for an artifact in the remote deployment repository. This ignores any update + * policy checks and mirrors and always retrieves the latest information from the given repository. + * + * @param artifact artifact we are interested in. Only groupid and artifactId are + * needed, for instance the following code will work + * artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" ) + * @param localRepository local repository + * @param deploymentRepository remote repository + * @return {@link List} $lt; {@link ArtifactVersion} > + * @throws ArtifactMetadataRetrievalException + * in case of error while retrieving repository metadata from the repository. + */ + List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) + throws ArtifactMetadataRetrievalException; +} \ No newline at end of file diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java new file mode 100644 index 0000000000..17af23f87f --- /dev/null +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java @@ -0,0 +1,61 @@ +package org.apache.maven.repository.legacy.metadata; + +/* + * 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.util.List; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; + +public class ResolutionGroup +{ + + private final Set artifacts; + + private final List resolutionRepositories; + + private final Artifact pomArtifact; + + public ResolutionGroup( Artifact pomArtifact, + Set artifacts, + List resolutionRepositories ) + { + this.pomArtifact = pomArtifact; + this.artifacts = artifacts; + this.resolutionRepositories = resolutionRepositories; + } + + public Artifact getPomArtifact() + { + return pomArtifact; + } + + public Set getArtifacts() + { + return artifacts; + } + + public List getResolutionRepositories() + { + return resolutionRepositories; + } + +} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/ArtifactCollector.java similarity index 90% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/ArtifactCollector.java index 478725c0a6..0a2f11c937 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/ArtifactCollector.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver; +package org.apache.maven.repository.legacy.resolver; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -26,8 +26,10 @@ import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.conflict.ConflictResolver; +import org.apache.maven.artifact.resolver.ArtifactResolutionResult; +import org.apache.maven.artifact.resolver.ResolutionListener; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; +import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; /** * Artifact collector - takes a set of original artifacts and resolves all of the best versions to use @@ -36,6 +38,7 @@ import org.apache.maven.artifact.resolver.filter.ArtifactFilter; * @author Brett Porter * @version $Id$ */ +@Deprecated public interface ArtifactCollector { diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollector.java similarity index 98% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollector.java index fba6bf0ad4..8d28d9e472 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollector.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver; +package org.apache.maven.repository.legacy.resolver; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -33,13 +33,19 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.metadata.ResolutionGroup; import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.conflict.ConflictResolver; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.ArtifactResolutionResult; +import org.apache.maven.artifact.resolver.CyclicDependencyException; +import org.apache.maven.artifact.resolver.ResolutionListener; +import org.apache.maven.artifact.resolver.ResolutionListenerForDepMgmt; +import org.apache.maven.artifact.resolver.ResolutionNode; import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ManagedVersionMap; import org.apache.maven.artifact.versioning.OverConstrainedVersionException; import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; @@ -438,9 +444,7 @@ public class DefaultArtifactCollector List versions = artifact.getAvailableVersions(); if ( versions == null ) { - versions = - source.retrieveAvailableVersions( artifact, localRepository, - childRemoteRepositories ); + versions = source.retrieveAvailableVersions( artifact, localRepository, childRemoteRepositories ); artifact.setAvailableVersions( versions ); } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java similarity index 96% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolver.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java index 610a0f099c..19aa5375ad 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolverFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java similarity index 96% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolverFactory.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java index 52a0e13784..b04b802fdb 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolverFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolverNotFoundException.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java similarity index 96% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolverNotFoundException.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java index de4769e6bf..adb32d9b25 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/ConflictResolverNotFoundException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java similarity index 95% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultConflictResolver.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java index c61e97f713..8845fc214f 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; import org.codehaus.plexus.component.annotations.Component; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultConflictResolverFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java similarity index 97% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultConflictResolverFactory.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java index 42ffe56fb9..bbb7f843c7 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultConflictResolverFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/FarthestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java similarity index 96% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/FarthestConflictResolver.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java index 2db7bb18fe..ec3e7e06b6 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/FarthestConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/NearestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java similarity index 96% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/NearestConflictResolver.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java index 806ab1a234..ba2e9b0ef2 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/NearestConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/NewestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java similarity index 97% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/NewestConflictResolver.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java index 5a27d5d29a..455ce162fd 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/NewestConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/OldestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java similarity index 97% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/OldestConflictResolver.java rename to maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java index dd0c282f94..9d49dd82ba 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/OldestConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java similarity index 99% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactMetadata.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java index 8632bdf577..cc99ccaf3c 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/ArtifactMetadata.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; import java.util.Collection; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/transform/ClasspathContainer.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java similarity index 92% rename from maven-compat/src/main/java/org/apache/maven/artifact/transform/ClasspathContainer.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java index 266d800a24..9618fed564 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/transform/ClasspathContainer.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java @@ -1,13 +1,10 @@ -package org.apache.maven.artifact.transform; +package org.apache.maven.repository.metadata; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.maven.artifact.ArtifactScopeEnum; -import org.apache.maven.artifact.resolver.metadata.ArtifactMetadata; -import org.apache.maven.artifact.resolver.metadata.MetadataResolutionException; -import org.apache.maven.artifact.resolver.metadata.MetadataTreeNode; /** * classpath container that is aware of the classpath scope diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/transform/ClasspathTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java similarity index 89% rename from maven-compat/src/main/java/org/apache/maven/artifact/transform/ClasspathTransformation.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java index babdb6c8bc..1f1af4aaf9 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/transform/ClasspathTransformation.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java @@ -1,7 +1,6 @@ -package org.apache.maven.artifact.transform; +package org.apache.maven.repository.metadata; import org.apache.maven.artifact.ArtifactScopeEnum; -import org.apache.maven.artifact.resolver.metadata.MetadataGraph; /** diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/transform/DefaultClasspathTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java similarity index 91% rename from maven-compat/src/main/java/org/apache/maven/artifact/transform/DefaultClasspathTransformation.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java index 6ddf1b4a33..a7d7406d5a 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/transform/DefaultClasspathTransformation.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.transform; +package org.apache.maven.repository.metadata; import java.util.ArrayList; import java.util.Arrays; @@ -6,12 +6,6 @@ import java.util.Comparator; import java.util.List; import org.apache.maven.artifact.ArtifactScopeEnum; -import org.apache.maven.artifact.resolver.conflict.GraphConflictResolutionException; -import org.apache.maven.artifact.resolver.conflict.GraphConflictResolver; -import org.apache.maven.artifact.resolver.metadata.ArtifactMetadata; -import org.apache.maven.artifact.resolver.metadata.MetadataGraph; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphEdge; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphVertex; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolutionPolicy.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java similarity index 91% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolutionPolicy.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java index 87a387f898..68e27817fd 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolutionPolicy.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java @@ -1,6 +1,5 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.metadata; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphEdge; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.codehaus.plexus.component.annotations.Component; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java similarity index 95% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolver.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java index 8e161bb8f0..caf41a426a 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.metadata; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -24,11 +24,6 @@ import java.util.List; import java.util.TreeSet; import org.apache.maven.artifact.ArtifactScopeEnum; -import org.apache.maven.artifact.resolver.metadata.ArtifactMetadata; -import org.apache.maven.artifact.resolver.metadata.MetadataGraph; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphEdge; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphVertex; -import org.apache.maven.artifact.resolver.metadata.MetadataResolutionException; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/GraphConflictResolutionException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java similarity index 91% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/GraphConflictResolutionException.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java index ffc9f7346c..1888a4ddd0 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/GraphConflictResolutionException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.metadata; /** * diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/GraphConflictResolutionPolicy.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java similarity index 77% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/GraphConflictResolutionPolicy.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java index df0a1faa78..e16a9d0690 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/GraphConflictResolutionPolicy.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java @@ -1,6 +1,5 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.metadata; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphEdge; /** * MetadataGraph edge selection policy. Complements diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/GraphConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java similarity index 93% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/GraphConflictResolver.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java index 6b6f6ee29b..9eeca9bd59 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/conflict/GraphConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.metadata; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +20,6 @@ package org.apache.maven.artifact.resolver.conflict; */ import org.apache.maven.artifact.ArtifactScopeEnum; -import org.apache.maven.artifact.resolver.metadata.MetadataGraph; /** * Resolves conflicts in the supplied dependency graph. diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataGraph.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java similarity index 99% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataGraph.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java index eeec2844ee..205315fb02 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataGraph.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; import java.util.ArrayList; import java.util.HashMap; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataGraphEdge.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java similarity index 98% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataGraphEdge.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java index 06cdf32d30..506ce17d29 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataGraphEdge.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; import org.apache.maven.artifact.ArtifactScopeEnum; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/transform/MetadataGraphTransformationException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java similarity index 92% rename from maven-compat/src/main/java/org/apache/maven/artifact/transform/MetadataGraphTransformationException.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java index 0897c18786..af1c8d65d4 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/transform/MetadataGraphTransformationException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.transform; +package org.apache.maven.repository.metadata; /** * @author Oleg Gusakov diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataGraphVertex.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java similarity index 98% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataGraphVertex.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java index 4389d86d96..62a3f5acfa 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataGraphVertex.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; import org.apache.maven.artifact.ArtifactScopeEnum; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolution.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java similarity index 96% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolution.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java index 44c99e04c9..6115a7038b 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolution.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; import java.util.Collection; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java similarity index 92% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionException.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java index 274cd3a5af..f9c6cd9168 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; public class MetadataResolutionException extends Exception diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionRequest.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java similarity index 97% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionRequest.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java index 30bba5808a..5bac06eb34 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionRequest.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; import java.util.List; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionRequestTypeEnum.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java similarity index 88% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionRequestTypeEnum.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java index c0ae7f2a04..25435a1737 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionRequestTypeEnum.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; public enum MetadataResolutionRequestTypeEnum { diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionResult.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java similarity index 92% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionResult.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java index 58033f86bc..6a89e4a5ca 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataResolutionResult.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java @@ -1,11 +1,6 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; import org.apache.maven.artifact.ArtifactScopeEnum; -import org.apache.maven.artifact.resolver.conflict.GraphConflictResolutionException; -import org.apache.maven.artifact.resolver.conflict.GraphConflictResolver; -import org.apache.maven.artifact.transform.ClasspathContainer; -import org.apache.maven.artifact.transform.ClasspathTransformation; -import org.apache.maven.artifact.transform.MetadataGraphTransformationException; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataRetrievalException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java similarity index 97% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataRetrievalException.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java index eccaa171ce..486474914b 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataRetrievalException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataSource.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java similarity index 96% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataSource.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java index 5b51dbe905..6cebb1a160 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataSource.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataTreeNode.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java similarity index 98% rename from maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataTreeNode.java rename to maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java index d050aa9b21..e15cb188d5 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/metadata/MetadataTreeNode.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.metadata; +package org.apache.maven.repository.metadata; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactScopeEnum; diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java b/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java index 053f7967eb..56334b181c 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java @@ -23,13 +23,13 @@ import java.util.Collections; import java.util.List; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.metadata.ResolutionGroup; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +import org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException; +import org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource; +import org.apache.maven.repository.legacy.metadata.ResolutionGroup; /** @author Jason van Zyl */ public class SimpleArtifactMetadataSource diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java index 4cef23c3c1..22866b89b1 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java @@ -11,5 +11,4 @@ public class DefaultArtifactResolverTest { ArtifactResolver resolver = lookup( ArtifactResolver.class, "default" ); } - } diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultUpdateCheckManagerTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java similarity index 98% rename from maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultUpdateCheckManagerTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java index 91d4fb79f7..d71ed326df 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultUpdateCheckManagerTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -27,6 +27,7 @@ import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; +import org.apache.maven.repository.legacy.DefaultUpdateCheckManager; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.console.ConsoleLogger; diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java similarity index 81% rename from maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java index 75c7424a25..09c16d7bee 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -23,7 +23,6 @@ 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; @@ -32,10 +31,13 @@ import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.repository.legacy.ChecksumFailedException; +import org.apache.maven.repository.legacy.DefaultWagonManager; +import org.apache.maven.repository.legacy.UpdateCheckManager; +import org.apache.maven.repository.legacy.WagonManager; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.UnsupportedProtocolException; @@ -45,10 +47,8 @@ import org.apache.maven.wagon.events.TransferEvent; import org.apache.maven.wagon.events.TransferListener; import org.apache.maven.wagon.observers.AbstractTransferListener; import org.apache.maven.wagon.observers.Debug; -import org.apache.maven.wagon.repository.Repository; import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.util.FileUtils; -import org.codehaus.plexus.util.xml.Xpp3Dom; import org.easymock.MockControl; /** @@ -81,14 +81,7 @@ public class DefaultWagonManagerTest artifactFactory = null; super.tearDown(); } - - public void testAvailableProtocols() - throws Exception - { - Set protocols = wagonManager.getSupportProtocols(); - System.out.println( protocols ); - } - + public void testUnnecessaryRepositoryLookup() throws Exception { Artifact artifact = createTestPomArtifact( "target/test-data/get-missing-pom" ); @@ -108,8 +101,7 @@ public class DefaultWagonManagerTest } }; TransferListener listener = new TransferListener(); - wagonManager.setDownloadMonitor(listener); - wagonManager.getArtifact( artifact, repos, listener, false ); + wagonManager.getArtifact( artifact, repos, listener ); assertEquals(1, listener.events.size()); } @@ -126,11 +118,9 @@ public class DefaultWagonManagerTest wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" ); MockControl control = MockControl.createControl( UpdateCheckManager.class ); - UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock(); - control.replay(); - wagonManager.getArtifact( artifact, repo, true ); + wagonManager.getArtifact( artifact, repo, null ); assertTrue( artifact.getFile().exists() ); assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) ); @@ -146,7 +136,7 @@ public class DefaultWagonManagerTest try { - wagonManager.getArtifact( artifact, repo, false ); + wagonManager.getArtifact( artifact, repo, null ); fail(); } @@ -166,7 +156,7 @@ public class DefaultWagonManagerTest try { - wagonManager.getArtifact( artifact, repo, true ); + wagonManager.getArtifact( artifact, repo, null ); fail(); } @@ -190,11 +180,9 @@ public class DefaultWagonManagerTest wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" ); MockControl control = MockControl.createControl( UpdateCheckManager.class ); - UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock(); - control.replay(); - wagonManager.getArtifact( artifact, repo, false ); + wagonManager.getArtifact( artifact, repo, null ); assertTrue( artifact.getFile().exists() ); assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) ); @@ -215,11 +203,9 @@ public class DefaultWagonManagerTest wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" ); MockControl control = MockControl.createControl( UpdateCheckManager.class ); - UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock(); - control.replay(); - wagonManager.getArtifact( artifact, repo, true ); + wagonManager.getArtifact( artifact, repo, null ); assertTrue( artifact.getFile().exists() ); assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) ); @@ -311,26 +297,6 @@ public class DefaultWagonManagerTest } } - public void testGetWagonRepositoryNullProtocol() - throws Exception - { - try - { - Repository repository = new Repository(); - - repository.setProtocol( null ); - - Wagon wagon = wagonManager.getWagon( repository ); - - fail( "Expected :" + UnsupportedProtocolException.class.getName() ); - } - catch ( UnsupportedProtocolException e ) - { - // ok - assertTrue( true ); - } - } - /** * Check that transfer listeners are properly removed after getArtifact and putArtifact */ @@ -345,8 +311,7 @@ public class DefaultWagonManagerTest /* getArtifact */ assertFalse( "Transfer listener is registered before test", wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); - wagonManager.setDownloadMonitor( transferListener ); - wagonManager.getArtifact( artifact, repo ); + wagonManager.getArtifact( artifact, repo, transferListener); assertFalse( "Transfer listener still registered after getArtifact", wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); @@ -354,12 +319,9 @@ public class DefaultWagonManagerTest File sampleFile = getTestFile( "target/test-file" ); FileUtils.fileWrite( sampleFile.getAbsolutePath(), "sample file" ); - assertFalse( "Transfer listener is registered before test", - wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); - wagonManager.setDownloadMonitor( transferListener ); - wagonManager.putArtifact( sampleFile, artifact, repo ); - assertFalse( "Transfer listener still registered after putArtifact", - wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); + assertFalse( "Transfer listener is registered before test", wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); + wagonManager.putArtifact( sampleFile, artifact, repo, transferListener ); + assertFalse( "Transfer listener still registered after putArtifact", wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); } /** @@ -385,7 +347,7 @@ public class DefaultWagonManagerTest try { - wagonManager.getArtifact( artifact, repo, true ); + wagonManager.getArtifact( artifact, repo, null ); } catch ( ChecksumFailedException e ) { @@ -398,7 +360,7 @@ public class DefaultWagonManagerTest try { - wagonManager.getArtifact( artifact, repo, true ); + wagonManager.getArtifact( artifact, repo, null ); } catch ( ChecksumFailedException e ) { @@ -411,7 +373,7 @@ public class DefaultWagonManagerTest try { - wagonManager.getArtifact( artifact, repo, true ); + wagonManager.getArtifact( artifact, repo, null ); fail( "Checksum verification did not fail" ); } catch ( ChecksumFailedException e ) @@ -425,7 +387,7 @@ public class DefaultWagonManagerTest try { - wagonManager.getArtifact( artifact, repo, true ); + wagonManager.getArtifact( artifact, repo, null ); } catch ( ChecksumFailedException e ) { @@ -438,7 +400,7 @@ public class DefaultWagonManagerTest try { - wagonManager.getArtifact( artifact, repo, true ); + wagonManager.getArtifact( artifact, repo, null ); } catch ( ChecksumFailedException e ) { @@ -451,7 +413,7 @@ public class DefaultWagonManagerTest try { - wagonManager.getArtifact( artifact, repo, true ); + wagonManager.getArtifact( artifact, repo, null ); fail( "Checksum verification did not fail" ); } catch ( ChecksumFailedException e ) @@ -468,32 +430,6 @@ public class DefaultWagonManagerTest assertNotNull( "Check wagon, protocol=" + protocol, wagon ); } - private void assertWagonRepository( String protocol ) - throws Exception - { - Repository repository = new Repository(); - - String s = "value=" + protocol; - - repository.setId( "id=" + protocol ); - - repository.setProtocol( protocol ); - - Xpp3Dom conf = new Xpp3Dom( "configuration" ); - - Xpp3Dom configurableField = new Xpp3Dom( "configurableField" ); - - configurableField.setValue( s ); - - conf.addChild( configurableField ); - - WagonMock wagon = (WagonMock) wagonManager.getWagon( repository ); - - assertNotNull( "Check wagon, protocol=" + protocol, wagon ); - - assertEquals( "Check configuration for wagon, protocol=" + protocol, s, wagon.getConfigurableField() ); - } - private final class ArtifactRepositoryLayoutStub implements ArtifactRepositoryLayout { diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/StringWagon.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java similarity index 98% rename from maven-compat/src/test/java/org/apache/maven/artifact/manager/StringWagon.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java index 439d6dd0c2..f5f561e16d 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/StringWagon.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonA.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java similarity index 96% rename from maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonA.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java index 3a69fafd0e..bb0dc878a8 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonA.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; import org.apache.maven.wagon.Wagon; import org.codehaus.plexus.component.annotations.Component; diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonB.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java similarity index 96% rename from maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonB.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java index 83775d1ca6..325ca71fd3 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonB.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; import org.apache.maven.wagon.Wagon; import org.codehaus.plexus.component.annotations.Component; diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonC.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java similarity index 96% rename from maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonC.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java index 7b6eb52e08..c22c1ad63e 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonC.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; import org.apache.maven.wagon.Wagon; import org.codehaus.plexus.component.annotations.Component; diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonMock.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java similarity index 97% rename from maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonMock.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java index aa2e420788..3c7a431776 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/manager/WagonMock.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.manager; +package org.apache.maven.repository.legacy; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java similarity index 99% rename from maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java index 2d5ad74c3b..7940af29fa 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver; +package org.apache.maven.repository.legacy.resolver; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -36,6 +36,9 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.metadata.ResolutionGroup; import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.ArtifactResolutionResult; +import org.apache.maven.artifact.resolver.CyclicDependencyException; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter; import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; @@ -44,6 +47,7 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.OverConstrainedVersionException; import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.repository.legacy.resolver.ArtifactCollector; import org.codehaus.plexus.PlexusTestCase; /** diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/AbstractConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java similarity index 97% rename from maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/AbstractConflictResolverTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java index f286d57aa2..276e22458b 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/AbstractConflictResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -24,6 +24,7 @@ import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.resolver.ResolutionNode; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; import org.codehaus.plexus.PlexusTestCase; /** diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/FarthestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java similarity index 95% rename from maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/FarthestConflictResolverTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java index 7d37bddfc4..779cf1693d 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/FarthestConflictResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -22,6 +22,7 @@ package org.apache.maven.artifact.resolver.conflict; import java.util.Collections; import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.repository.legacy.resolver.conflict.FarthestConflictResolver; /** * Tests FarthestConflictResolver. diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/NearestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java similarity index 95% rename from maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/NearestConflictResolverTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java index 09b439b789..e05768a680 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/NearestConflictResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -22,6 +22,7 @@ package org.apache.maven.artifact.resolver.conflict; import java.util.Collections; import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.repository.legacy.resolver.conflict.NearestConflictResolver; /** * Tests NearestConflictResolver. diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/NewestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java similarity index 95% rename from maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/NewestConflictResolverTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java index 90083ab561..b030f5b47a 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/NewestConflictResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -22,6 +22,7 @@ package org.apache.maven.artifact.resolver.conflict; import java.util.Collections; import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.repository.legacy.resolver.conflict.NewestConflictResolver; /** * Tests NewestConflictResolver. diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/OldestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java similarity index 95% rename from maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/OldestConflictResolverTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java index a5023c678a..f23ff2a884 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/OldestConflictResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java @@ -1,4 +1,4 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.legacy.resolver.conflict; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -22,6 +22,7 @@ package org.apache.maven.artifact.resolver.conflict; import java.util.Collections; import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.repository.legacy.resolver.conflict.OldestConflictResolver; /** * Tests OldestConflictResolver. diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/transform/DefaultClasspathTransformationTest.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java similarity index 90% rename from maven-compat/src/test/java/org/apache/maven/artifact/transform/DefaultClasspathTransformationTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java index e9b7183169..5f97658d2f 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/transform/DefaultClasspathTransformationTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java @@ -1,10 +1,12 @@ -package org.apache.maven.artifact.transform; +package org.apache.maven.repository.metadata; import org.apache.maven.artifact.ArtifactScopeEnum; -import org.apache.maven.artifact.resolver.metadata.ArtifactMetadata; -import org.apache.maven.artifact.resolver.metadata.MetadataGraph; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphEdge; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphVertex; +import org.apache.maven.repository.metadata.ArtifactMetadata; +import org.apache.maven.repository.metadata.ClasspathContainer; +import org.apache.maven.repository.metadata.ClasspathTransformation; +import org.apache.maven.repository.metadata.MetadataGraph; +import org.apache.maven.repository.metadata.MetadataGraphEdge; +import org.apache.maven.repository.metadata.MetadataGraphVertex; import org.codehaus.plexus.PlexusTestCase; /** diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolutionPolicyTest.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java similarity index 88% rename from maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolutionPolicyTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java index eeac6f6604..ffdb0b5e5a 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolutionPolicyTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java @@ -1,6 +1,7 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.metadata; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphEdge; +import org.apache.maven.repository.metadata.GraphConflictResolutionPolicy; +import org.apache.maven.repository.metadata.MetadataGraphEdge; import org.codehaus.plexus.PlexusTestCase; /** diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java similarity index 94% rename from maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolverTest.java rename to maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java index 876ef453f1..b22eba5ea1 100644 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/conflict/DefaultGraphConflictResolverTest.java +++ b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java @@ -1,10 +1,11 @@ -package org.apache.maven.artifact.resolver.conflict; +package org.apache.maven.repository.metadata; import org.apache.maven.artifact.ArtifactScopeEnum; -import org.apache.maven.artifact.resolver.metadata.ArtifactMetadata; -import org.apache.maven.artifact.resolver.metadata.MetadataGraph; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphEdge; -import org.apache.maven.artifact.resolver.metadata.MetadataGraphVertex; +import org.apache.maven.repository.metadata.ArtifactMetadata; +import org.apache.maven.repository.metadata.GraphConflictResolver; +import org.apache.maven.repository.metadata.MetadataGraph; +import org.apache.maven.repository.metadata.MetadataGraphEdge; +import org.apache.maven.repository.metadata.MetadataGraphVertex; import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.logging.Logger; diff --git a/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java new file mode 100644 index 0000000000..28fa58ab9b --- /dev/null +++ b/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java @@ -0,0 +1,79 @@ +package org.apache.maven.repository.metadata; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException; +import org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource; +import org.apache.maven.repository.legacy.metadata.ResolutionGroup; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +@Component(role = ArtifactMetadataSource.class) +public class TestMetadataSource + implements ArtifactMetadataSource +{ + @Requirement + private ArtifactFactory factory; + + public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + throws ArtifactMetadataRetrievalException + { + Set dependencies = new HashSet(); + + if ( "g".equals( artifact.getArtifactId() ) ) + { + Artifact a = null; + try + { + a = factory.createBuildArtifact( "org.apache.maven", "h", "1.0", "jar" ); + dependencies.add( a ); + } + catch ( Exception e ) + { + throw new ArtifactMetadataRetrievalException( "Error retrieving metadata", e, a ); + } + } + + if ( "i".equals( artifact.getArtifactId() ) ) + { + Artifact a = null; + try + { + a = factory.createBuildArtifact( "org.apache.maven", "j", "1.0-SNAPSHOT", "jar" ); + dependencies.add( a ); + } + catch ( Exception e ) + { + throw new ArtifactMetadataRetrievalException( "Error retrieving metadata", e, a ); + } + } + + + return new ResolutionGroup( artifact, dependencies, remoteRepositories ); + } + + public List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + throws ArtifactMetadataRetrievalException + { + throw new UnsupportedOperationException( "Cannot get available versions in this test case" ); + } + + public List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) + throws ArtifactMetadataRetrievalException + { + throw new UnsupportedOperationException( "Cannot get available versions in this test case" ); + } + + public Artifact retrieveRelocatedArtifact( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + throws ArtifactMetadataRetrievalException + { + return artifact; + } +}