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
This commit is contained in:
Jason van Zyl 2009-06-28 09:39:49 +00:00
parent 84bfe465ef
commit ba289ad502
85 changed files with 956 additions and 1240 deletions

View File

@ -20,7 +20,6 @@
</parent> </parent>
<artifactId>maven-compat</artifactId> <artifactId>maven-compat</artifactId>
<name>Maven Compat</name> <name>Maven Compat</name>
<dependencies> <dependencies>

View File

@ -1,22 +1,18 @@
package org.apache.maven.artifact.deployer; package org.apache.maven.artifact.deployer;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* or more contributor license agreements. See the NOTICE file * agreements. See the NOTICE file distributed with this work for additional information regarding
* distributed with this work for additional information * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
* regarding copyright ownership. The ASF licenses this file * "License"); you may not use this file except in compliance with the License. You may obtain a
* to you under the Apache License, Version 2.0 (the * copy of the License at
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing, software distributed under the License
* software distributed under the License is distributed on an * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * or implied. See the License for the specific language governing permissions and limitations under
* KIND, either express or implied. See the License for the * the License.
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;
@ -29,8 +25,8 @@ public interface ArtifactDeployer
String ROLE = ArtifactDeployer.class.getName(); String ROLE = ArtifactDeployer.class.getName();
/** /**
* Deploy an artifact from a particular directory. The artifact handler is used to determine the filename * Deploy an artifact from a particular directory. The artifact handler is used to determine the
* of the source file. * filename of the source file.
* *
* @param basedir the directory where the artifact is stored * @param basedir the directory where the artifact is stored
* @param finalName the name of the artifact sans extension * @param finalName the name of the artifact sans extension
@ -38,14 +34,11 @@ public interface ArtifactDeployer
* @param deploymentRepository the repository to deploy to * @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 * @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 @Deprecated
void deploy( String basedir, void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository )
String finalName,
Artifact artifact,
ArtifactRepository deploymentRepository,
ArtifactRepository localRepository )
throws ArtifactDeploymentException; throws ArtifactDeploymentException;
/** /**
@ -57,9 +50,6 @@ public interface ArtifactDeployer
* @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 * @throws ArtifactDeploymentException if an error occurred deploying the artifact
*/ */
void deploy( File source, void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository )
Artifact artifact,
ArtifactRepository deploymentRepository,
ArtifactRepository localRepository )
throws ArtifactDeploymentException; throws ArtifactDeploymentException;
} }

View File

@ -19,14 +19,12 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import org.apache.maven.artifact.Artifact; 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.ArtifactMetadata;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository; 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.RepositoryMetadataDeploymentException;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
import org.apache.maven.artifact.transform.ArtifactTransformationManager; import org.apache.maven.artifact.transform.ArtifactTransformationManager;
import org.apache.maven.repository.legacy.WagonManager;
import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.TransferFailedException;
import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.annotations.Requirement;
@ -47,12 +45,6 @@ public class DefaultArtifactDeployer
@Requirement @Requirement
private RepositoryMetadataManager repositoryMetadataManager; 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 * @deprecated we want to use the artifact method only, and ensure artifact.file is set
* correctly. * correctly.

View File

@ -20,9 +20,9 @@ import org.apache.maven.artifact.versioning.VersionRange;
public interface ArtifactFactory public interface ArtifactFactory
{ {
@Deprecated
String ROLE = ArtifactFactory.class.getName(); 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 createArtifact( String groupId, String artifactId, String version, String scope, String type );
Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ); Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier );

View File

@ -1,22 +1,18 @@
package org.apache.maven.artifact.installer; package org.apache.maven.artifact.installer;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* or more contributor license agreements. See the NOTICE file * agreements. See the NOTICE file distributed with this work for additional information regarding
* distributed with this work for additional information * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
* regarding copyright ownership. The ASF licenses this file * "License"); you may not use this file except in compliance with the License. You may obtain a
* to you under the Apache License, Version 2.0 (the * copy of the License at
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing, software distributed under the License
* software distributed under the License is distributed on an * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * or implied. See the License for the specific language governing permissions and limitations under
* KIND, either express or implied. See the License for the * the License.
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.File; import java.io.File;
@ -33,24 +29,21 @@ public interface ArtifactInstaller
String ROLE = ArtifactInstaller.class.getName(); String ROLE = ArtifactInstaller.class.getName();
/** /**
* Install an artifact from a particular directory. The artifact handler is used to determine the filename * Install an artifact from a particular directory. The artifact handler is used to determine
* of the source file. * the filename of the source file.
* *
* @param basedir the directory where the artifact is stored * @param basedir the directory where the artifact is stored
* @param finalName the name of the artifact sans extension * @param finalName the name of the artifact sans extension
* @param artifact the artifact definition * @param artifact the artifact definition
* @param localRepository the local repository to install into * @param localRepository the local repository to install into
* @throws ArtifactInstallationException if an error occurred installing the artifact * @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 @Deprecated
void install( String basedir, void install( String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository )
String finalName,
Artifact artifact,
ArtifactRepository localRepository )
throws ArtifactInstallationException; throws ArtifactInstallationException;
/** /**
* Install an artifact from a particular file. * Install an artifact from a particular file.
* *
@ -59,8 +52,6 @@ public interface ArtifactInstaller
* @param localRepository the local repository to install into * @param localRepository the local repository to install into
* @throws ArtifactInstallationException if an error occurred installing the artifact * @throws ArtifactInstallationException if an error occurred installing the artifact
*/ */
void install( File source, void install( File source, Artifact artifact, ArtifactRepository localRepository )
Artifact artifact,
ArtifactRepository localRepository )
throws ArtifactInstallationException; throws ArtifactInstallationException;
} }

View File

@ -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 <a href="http://maven.apache.org/wagon">Wagon</a> related operations in Maven.
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka </a>
* @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<ArtifactRepository> 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<String> 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;
}

View File

@ -21,46 +21,13 @@ package org.apache.maven.artifact.metadata;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
/** @Deprecated
* Common elements of artifact metadata.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
public abstract class AbstractArtifactMetadata 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 ) protected AbstractArtifactMetadata( Artifact artifact )
{ {
this.artifact = artifact; super( 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();
} }
} }

View File

@ -19,66 +19,9 @@ package org.apache.maven.artifact.metadata;
* under the License. * under the License.
*/ */
import org.apache.maven.artifact.repository.ArtifactRepository; @Deprecated
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
/**
* Contains metadata about an artifact, and methods to retrieve/store it from an artifact repository.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
* @todo merge with artifactmetadatasource
* @todo retrieval exception not appropriate for store
*/
public interface ArtifactMetadata 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 ); 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();
} }

View File

@ -21,49 +21,12 @@ package org.apache.maven.artifact.metadata;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
/** @Deprecated
* Error while retrieving repository metadata from the repository.
*
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
public class ArtifactMetadataRetrievalException public class ArtifactMetadataRetrievalException
extends Exception extends org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException
{ {
private Artifact artifact; public ArtifactMetadataRetrievalException( String message, Throwable cause, Artifact artifact )
/** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */
@Deprecated
public ArtifactMetadataRetrievalException( String message )
{ {
this( message, null, null ); super( message, cause, artifact );
}
/** @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;
} }
} }

View File

@ -1,70 +1,36 @@
package org.apache.maven.artifact.metadata; 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 java.util.List;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ArtifactVersion;
/** /*
* Provides some metadata operations, like querying the remote repository for a list of versions available for an * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* artifact. * 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
* *
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a> * http://www.apache.org/licenses/LICENSE-2.0
* @version $Id$ *
* 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 public interface ArtifactMetadataSource
extends org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource
{ {
ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories ) ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException; throws ArtifactMetadataRetrievalException;
/**
* Get a list of available versions for an artifact in the remote repository
*
* @param artifact artifact we are interested in. Only <code>groupid</code> and <code>artifactId</code>
* are needed, for instance the following code will work
* <code>artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" )</code>
* @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<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories ) List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException; 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 <code>groupid</code> and <code>artifactId</code> are
* needed, for instance the following code will work
* <code>artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" )</code>
* @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<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository )
throws ArtifactMetadataRetrievalException; throws ArtifactMetadataRetrievalException;
} }

View File

@ -1,22 +1,18 @@
package org.apache.maven.artifact.metadata; package org.apache.maven.artifact.metadata;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* or more contributor license agreements. See the NOTICE file * agreements. See the NOTICE file distributed with this work for additional information regarding
* distributed with this work for additional information * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
* regarding copyright ownership. The ASF licenses this file * "License"); you may not use this file except in compliance with the License. You may obtain a
* to you under the Apache License, Version 2.0 (the * copy of the License at
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing, software distributed under the License
* software distributed under the License is distributed on an * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * or implied. See the License for the specific language governing permissions and limitations under
* KIND, either express or implied. See the License for the * the License.
* specific language governing permissions and limitations
* under the License.
*/ */
import java.util.List; import java.util.List;
@ -25,37 +21,12 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
@Deprecated
public class ResolutionGroup public class ResolutionGroup
extends org.apache.maven.repository.legacy.metadata.ResolutionGroup
{ {
public ResolutionGroup( Artifact pomArtifact, Set<Artifact> artifacts, List<ArtifactRepository> resolutionRepositories )
private final Set<Artifact> artifacts;
private final List<ArtifactRepository> resolutionRepositories;
private final Artifact pomArtifact;
public ResolutionGroup( Artifact pomArtifact,
Set<Artifact> artifacts,
List<ArtifactRepository> resolutionRepositories )
{ {
this.pomArtifact = pomArtifact; super( pomArtifact, artifacts, resolutionRepositories );
this.artifacts = artifacts;
this.resolutionRepositories = resolutionRepositories;
} }
public Artifact getPomArtifact()
{
return pomArtifact;
}
public Set<Artifact> getArtifacts()
{
return artifacts;
}
public List<ArtifactRepository> getResolutionRepositories()
{
return resolutionRepositories;
}
} }

View File

@ -44,9 +44,6 @@ public class MavenArtifactRepository
private ArtifactRepositoryPolicy releases; private ArtifactRepositoryPolicy releases;
//TODO: this should be tracked externally, not by the repository itself
private boolean blacklisted;
public MavenArtifactRepository() public MavenArtifactRepository()
{ {
} }
@ -124,16 +121,6 @@ public class MavenArtifactRepository
return getId(); return getId();
} }
public boolean isBlacklisted()
{
return blacklisted;
}
public void setBlacklisted( boolean blacklisted )
{
this.blacklisted = blacklisted;
}
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();

View File

@ -189,6 +189,13 @@ public abstract class AbstractRepositoryMetadata
return metadata; 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 ) public void merge( ArtifactMetadata metadata )
{ {
// TODO: not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact replaces? // TODO: not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact replaces?

View File

@ -23,12 +23,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; 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.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; 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.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.TransferFailedException;
import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Component;

View File

@ -19,7 +19,7 @@ package org.apache.maven.artifact.repository.metadata;
* under the License. * under the License.
*/ */
import org.apache.maven.artifact.metadata.ArtifactMetadata; //import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
/** /**
@ -30,7 +30,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
* @todo not happy about the store method - they use "this" * @todo not happy about the store method - they use "this"
*/ */
public interface RepositoryMetadata public interface RepositoryMetadata
extends ArtifactMetadata extends org.apache.maven.artifact.metadata.ArtifactMetadata
{ {
/** /**
* Set the repository the metadata was located in. * Set the repository the metadata was located in.

View File

@ -1,31 +1,27 @@
package org.apache.maven.artifact.resolver; package org.apache.maven.artifact.resolver;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* or more contributor license agreements. See the NOTICE file * agreements. See the NOTICE file distributed with this work for additional information regarding
* distributed with this work for additional information * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
* regarding copyright ownership. The ASF licenses this file * "License"); you may not use this file except in compliance with the License. You may obtain a
* to you under the Apache License, Version 2.0 (the * copy of the License at
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing, software distributed under the License
* software distributed under the License is distributed on an * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * or implied. See the License for the specific language governing permissions and limitations under
* KIND, either express or implied. See the License for the * the License.
* specific language governing permissions and limitations
* under the License.
*/ */
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import org.apache.maven.artifact.Artifact; 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.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
import org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.TransferFailedException;
/** /**
@ -35,46 +31,28 @@ import org.apache.maven.wagon.TransferFailedException;
public class ArtifactResolutionException public class ArtifactResolutionException
extends AbstractArtifactResolutionException extends AbstractArtifactResolutionException
{ {
public ArtifactResolutionException( String message, public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, String classifier, List<ArtifactRepository> remoteRepositories, List path,
String groupId,
String artifactId,
String version,
String type,
String classifier,
List<ArtifactRepository> remoteRepositories,
List path,
Throwable t ) Throwable t )
{ {
super( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, t ); super( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, t );
} }
public ArtifactResolutionException( String message, public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, String classifier, Throwable t )
String groupId,
String artifactId,
String version,
String type,
String classifier,
Throwable t )
{ {
super( message, groupId, artifactId, version, type, classifier, null, null, t ); super( message, groupId, artifactId, version, type, classifier, null, null, t );
} }
public ArtifactResolutionException( String message, public ArtifactResolutionException( String message, Artifact artifact )
Artifact artifact )
{ {
super( message, artifact ); super( message, artifact );
} }
public ArtifactResolutionException( String message, public ArtifactResolutionException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories )
Artifact artifact,
List<ArtifactRepository> remoteRepositories )
{ {
super( message, artifact, remoteRepositories ); super( message, artifact, remoteRepositories );
} }
public ArtifactResolutionException( String message, public ArtifactResolutionException( String message, Artifact artifact, ArtifactMetadataRetrievalException cause )
Artifact artifact,
ArtifactMetadataRetrievalException cause )
{ {
super( message, artifact, null, cause ); super( message, artifact, null, cause );
} }
@ -85,40 +63,28 @@ public class ArtifactResolutionException
super( message, artifact, null, cause ); super( message, artifact, null, cause );
} }
protected ArtifactResolutionException( String message, public ArtifactResolutionException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactMetadataRetrievalException cause )
Artifact artifact,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataRetrievalException cause )
{ {
super( message, artifact, remoteRepositories, cause ); super( message, artifact, remoteRepositories, cause );
} }
@Deprecated @Deprecated
protected ArtifactResolutionException( String message, Artifact artifact, protected ArtifactResolutionException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories, Throwable cause )
List<ArtifactRepository> remoteRepositories, Throwable cause )
{ {
super( message, artifact, remoteRepositories, cause ); super( message, artifact, remoteRepositories, cause );
} }
protected ArtifactResolutionException( String message, protected ArtifactResolutionException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories, TransferFailedException cause )
Artifact artifact,
List<ArtifactRepository> remoteRepositories,
TransferFailedException cause )
{ {
super( message, artifact, remoteRepositories, cause ); super( message, artifact, remoteRepositories, cause );
} }
protected ArtifactResolutionException( String message, protected ArtifactResolutionException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories, IOException cause )
Artifact artifact,
List<ArtifactRepository> remoteRepositories,
IOException cause )
{ {
super( message, artifact, remoteRepositories, cause ); super( message, artifact, remoteRepositories, cause );
} }
public ArtifactResolutionException( String message, public ArtifactResolutionException( String message, Artifact artifact, RepositoryMetadataResolutionException cause )
Artifact artifact,
RepositoryMetadataResolutionException cause )
{ {
super( message, artifact, null, cause ); super( message, artifact, null, cause );
} }

View File

@ -24,6 +24,7 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; 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: * Specific problems during resolution that we want to account for:

View File

@ -11,27 +11,24 @@ import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.wagon.events.TransferListener; import org.apache.maven.wagon.events.TransferListener;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* or more contributor license agreements. See the NOTICE file * agreements. See the NOTICE file distributed with this work for additional information regarding
* distributed with this work for additional information * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
* regarding copyright ownership. The ASF licenses this file * "License"); you may not use this file except in compliance with the License. You may obtain a
* to you under the Apache License, Version 2.0 (the * copy of the License at
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unless required by applicable law or agreed to in writing, software distributed under the License
* software distributed under the License is distributed on an * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * or implied. See the License for the specific language governing permissions and limitations under
* KIND, either express or implied. See the License for the * the License.
* specific language governing permissions and limitations
* under the License.
*/ */
/** /**
* @author Jason van Zyl * @author Jason van Zyl
*/ */
// Just hide the one method we want behind the RepositorySystem interface.
public interface ArtifactResolver public interface ArtifactResolver
{ {
ArtifactResolutionResult resolve( ArtifactResolutionRequest request ); ArtifactResolutionResult resolve( ArtifactResolutionRequest request );
@ -44,18 +41,14 @@ public interface ArtifactResolver
// USED BY SUREFIRE // USED BY SUREFIRE
@Deprecated @Deprecated
ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter ) ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
// USED BY MAVEN ASSEMBLY PLUGIN // USED BY MAVEN ASSEMBLY PLUGIN
@Deprecated @Deprecated
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
Map managedVersions, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter )
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
// USED BY REMOTE RESOURCES PLUGIN // USED BY REMOTE RESOURCES PLUGIN

View File

@ -27,8 +27,6 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory; 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.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository; 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.Snapshot;
import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
import org.apache.maven.artifact.repository.metadata.Versioning; 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.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.transform.ArtifactTransformationManager; 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.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.events.TransferListener; import org.apache.maven.wagon.events.TransferListener;
@ -146,10 +147,6 @@ public class DefaultArtifactResolver
return; return;
} }
//String localPath = localRepository.pathOf( artifact );
//artifact.setFile( new File( localRepository.getBasedir(), localPath ) );
transformationManager.transformForResolve( artifact, remoteRepositories, localRepository ); transformationManager.transformForResolve( artifact, remoteRepositories, localRepository );
boolean localCopy = isLocalCopy( artifact ); boolean localCopy = isLocalCopy( artifact );
@ -158,13 +155,6 @@ public class DefaultArtifactResolver
boolean resolved = false; 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 ) ) if ( force || !destination.exists() || ( artifact.isSnapshot() && !localCopy ) )
{ {
try try
@ -172,11 +162,11 @@ public class DefaultArtifactResolver
if ( artifact.getRepository() != null ) if ( artifact.getRepository() != null )
{ {
// the transformations discovered the artifact - so use it exclusively // the transformations discovered the artifact - so use it exclusively
wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor, force ); wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor );
} }
else else
{ {
wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor, force ); wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor );
} }
if ( !artifact.isResolved() && !destination.exists() ) if ( !artifact.isResolved() && !destination.exists() )

View File

@ -22,7 +22,6 @@ package org.apache.maven.artifact.transform;
import java.util.List; import java.util.List;
import org.apache.maven.artifact.Artifact; 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.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
import org.apache.maven.artifact.repository.metadata.Metadata; 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.RepositoryMetadataResolutionException;
import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
import org.apache.maven.artifact.repository.metadata.Versioning; 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.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;

View File

@ -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;
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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 );
}
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
@Deprecated
public interface RuntimeInformation
{
ApplicationInformation getApplicationInformation();
/** @deprecated Use getApplicationInformation() */
//!!BC Used by the Eclipse Plugin
ArtifactVersion getApplicationVersion();
}

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * 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.File;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata; 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.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.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.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.logging.Logger;
import org.codehaus.plexus.util.FileUtils; 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) @Component(role = WagonManager.class)
public class DefaultWagonManager public class DefaultWagonManager
implements WagonManager implements WagonManager
@ -66,262 +61,17 @@ public class DefaultWagonManager
@Requirement @Requirement
private PlexusContainer container; private PlexusContainer container;
/** Map( String, XmlPlexusConfiguration ) with the repository id and the wagon configuration */
private Map<String, XmlPlexusConfiguration> serverConfigurationMap = new HashMap<String, XmlPlexusConfiguration>();
@Requirement(role = Wagon.class) @Requirement(role = Wagon.class)
private Map<String, Wagon> wagons; private Map<String, Wagon> wagons;
@Requirement @Requirement
private UpdateCheckManager updateCheckManager; private UpdateCheckManager updateCheckManager;
private String httpUserAgent = "Apache-Maven/3.0-alpha-1"; //
// Retriever
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<String, ChecksumObserver> checksums = new HashMap<String, ChecksumObserver>( 2 );
Map<String, String> sums = new HashMap<String, String>( 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<ArtifactRepository> remoteRepositories, TransferListener downloadMonitor )
throws TransferFailedException, ResourceDoesNotExistException
{
getArtifact( artifact, remoteRepositories, downloadMonitor, true );
}
public void getArtifact( Artifact artifact, List<ArtifactRepository> 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" );
}
}
public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor ) public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor )
throws TransferFailedException, ResourceDoesNotExistException 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 ); String remotePath = repository.pathOf( artifact );
@ -337,7 +87,7 @@ public class DefaultWagonManager
// If the artifact is a snapshot, we need to determine whether it's time to check this repository for an update: // 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 // 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. // 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() ); logger.debug( "Trying repository " + repository.getId() );
@ -362,7 +112,7 @@ public class DefaultWagonManager
else if ( "pom".equals( artifact.getType() ) && !artifact.getFile().exists() ) 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 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() ); logger.debug( "Trying repository " + repository.getId() );
@ -408,6 +158,40 @@ public class DefaultWagonManager
} }
} }
public void getArtifact( Artifact artifact, List<ArtifactRepository> 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 ) public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
@ -434,8 +218,6 @@ public class DefaultWagonManager
try try
{ {
wagon = getWagon( protocol ); wagon = getWagon( protocol );
configureWagon( wagon, repository );
} }
catch ( UnsupportedProtocolException e ) catch ( UnsupportedProtocolException e )
{ {
@ -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<String, ChecksumObserver> checksums = new HashMap<String, ChecksumObserver>( 2 );
Map<String, String> sums = new HashMap<String, String>( 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 ) private void handleChecksumFailure( String checksumPolicy, String message, Throwable cause )
throws ChecksumFailedException throws ChecksumFailedException
{ {
@ -729,95 +644,23 @@ public class DefaultWagonManager
} }
} }
/** @Deprecated
* Checks the URL to see if this repository refers to an external repository public Wagon getWagon( String protocol )
* throws UnsupportedProtocolException
* @param originalRepository
* @return true if external.
*/
public boolean isExternalRepo( ArtifactRepository originalRepository )
{ {
try if ( protocol == null )
{ {
URL url = new URL( originalRepository.getUrl() ); throw new UnsupportedProtocolException( "Unspecified protocol" );
return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) || url.getProtocol().equals( "file" ) );
}
catch ( MalformedURLException e )
{
// bad url just skip it here. It should have been validated already, but the wagon lookup will deal with it
return false;
}
} }
/** String hint = protocol.toLowerCase( java.util.Locale.ENGLISH );
* Applies the server configuration to the wagon Wagon wagon = (Wagon) wagons.get( hint );
*
* @param wagon the wagon to configure if ( wagon == null )
* @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() ); throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: " + protocol );
} }
private void configureWagon( Wagon wagon, String repositoryId, String protocol ) return wagon;
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<String> getSupportProtocols()
{
return wagons.keySet();
} }
} }

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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<ArtifactRepository> 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;
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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();
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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();
}

View File

@ -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 <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @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;
}
}

View File

@ -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 <a href="mailto:jason@maven.org">Jason van Zyl </a>
* @version $Id$
*/
public interface ArtifactMetadataSource
{
ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException;
/**
* Get a list of available versions for an artifact in the remote repository
*
* @param artifact artifact we are interested in. Only <code>groupid</code> and <code>artifactId</code>
* are needed, for instance the following code will work
* <code>artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" )</code>
* @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<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> 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 <code>groupid</code> and <code>artifactId</code> are
* needed, for instance the following code will work
* <code>artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" )</code>
* @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<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository )
throws ArtifactMetadataRetrievalException;
}

View File

@ -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<Artifact> artifacts;
private final List<ArtifactRepository> resolutionRepositories;
private final Artifact pomArtifact;
public ResolutionGroup( Artifact pomArtifact,
Set<Artifact> artifacts,
List<ArtifactRepository> resolutionRepositories )
{
this.pomArtifact = pomArtifact;
this.artifacts = artifacts;
this.resolutionRepositories = resolutionRepositories;
}
public Artifact getPomArtifact()
{
return pomArtifact;
}
public Set<Artifact> getArtifacts()
{
return artifacts;
}
public List<ArtifactRepository> getResolutionRepositories()
{
return resolutionRepositories;
}
}

View File

@ -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 * 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.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository; 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.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 * 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 <a href="mailto:brett@apache.org">Brett Porter</a> * @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$ * @version $Id$
*/ */
@Deprecated
public interface ArtifactCollector public interface ArtifactCollector
{ {

View File

@ -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 * 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.ArtifactMetadataSource;
import org.apache.maven.artifact.metadata.ResolutionGroup; import org.apache.maven.artifact.metadata.ResolutionGroup;
import org.apache.maven.artifact.repository.ArtifactRepository; 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.AndArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.ManagedVersionMap; import org.apache.maven.artifact.versioning.ManagedVersionMap;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
import org.apache.maven.artifact.versioning.VersionRange; 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.Component;
import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.Logger;
@ -438,9 +444,7 @@ public class DefaultArtifactCollector
List<ArtifactVersion> versions = artifact.getAvailableVersions(); List<ArtifactVersion> versions = artifact.getAvailableVersions();
if ( versions == null ) if ( versions == null )
{ {
versions = versions = source.retrieveAvailableVersions( artifact, localRepository, childRemoteRepositories );
source.retrieveAvailableVersions( artifact, localRepository,
childRemoteRepositories );
artifact.setAvailableVersions( versions ); artifact.setAvailableVersions( versions );
} }

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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; import org.codehaus.plexus.component.annotations.Component;

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.metadata; package org.apache.maven.repository.metadata;
import java.util.Collection; import java.util.Collection;

View File

@ -1,13 +1,10 @@
package org.apache.maven.artifact.transform; package org.apache.maven.repository.metadata;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.maven.artifact.ArtifactScopeEnum; 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 * classpath container that is aware of the classpath scope

View File

@ -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.ArtifactScopeEnum;
import org.apache.maven.artifact.resolver.metadata.MetadataGraph;
/** /**

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.transform; package org.apache.maven.repository.metadata;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -6,12 +6,6 @@ import java.util.Comparator;
import java.util.List; import java.util.List;
import org.apache.maven.artifact.ArtifactScopeEnum; 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.Component;
import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.annotations.Requirement;

View File

@ -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.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Component;

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one
@ -24,11 +24,6 @@ import java.util.List;
import java.util.TreeSet; import java.util.TreeSet;
import org.apache.maven.artifact.ArtifactScopeEnum; 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.Component;
import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.annotations.Requirement;

View File

@ -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 * MetadataGraph edge selection policy. Complements

View File

@ -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 * 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.ArtifactScopeEnum;
import org.apache.maven.artifact.resolver.metadata.MetadataGraph;
/** /**
* Resolves conflicts in the supplied dependency graph. * Resolves conflicts in the supplied dependency graph.

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.metadata; package org.apache.maven.repository.metadata;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.metadata; package org.apache.maven.repository.metadata;
import org.apache.maven.artifact.ArtifactScopeEnum; import org.apache.maven.artifact.ArtifactScopeEnum;

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.transform; package org.apache.maven.repository.metadata;
/** /**
* @author <a href="oleg@codehaus.org">Oleg Gusakov</a> * @author <a href="oleg@codehaus.org">Oleg Gusakov</a>

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.metadata; package org.apache.maven.repository.metadata;
import org.apache.maven.artifact.ArtifactScopeEnum; import org.apache.maven.artifact.ArtifactScopeEnum;

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.metadata; package org.apache.maven.repository.metadata;
import java.util.Collection; import java.util.Collection;

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.metadata; package org.apache.maven.repository.metadata;
public class MetadataResolutionException public class MetadataResolutionException
extends Exception extends Exception

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.metadata; package org.apache.maven.repository.metadata;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.resolver.metadata; package org.apache.maven.repository.metadata;
public enum MetadataResolutionRequestTypeEnum public enum MetadataResolutionRequestTypeEnum
{ {

View File

@ -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.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.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException;

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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.Artifact;
import org.apache.maven.artifact.ArtifactScopeEnum; import org.apache.maven.artifact.ArtifactScopeEnum;

View File

@ -23,13 +23,13 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.maven.artifact.Artifact; 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.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion; 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 */ /** @author Jason van Zyl */
public class SimpleArtifactMetadataSource public class SimpleArtifactMetadataSource

View File

@ -11,5 +11,4 @@ public class DefaultArtifactResolverTest
{ {
ArtifactResolver resolver = lookup( ArtifactResolver.class, "default" ); ArtifactResolver resolver = lookup( ArtifactResolver.class, "default" );
} }
} }

View File

@ -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 * 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.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; 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.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger; import org.codehaus.plexus.logging.console.ConsoleLogger;

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one
@ -23,7 +23,6 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact; 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.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; 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.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.artifact.versioning.VersionRange; 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.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.UnsupportedProtocolException; 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.events.TransferListener;
import org.apache.maven.wagon.observers.AbstractTransferListener; import org.apache.maven.wagon.observers.AbstractTransferListener;
import org.apache.maven.wagon.observers.Debug; import org.apache.maven.wagon.observers.Debug;
import org.apache.maven.wagon.repository.Repository;
import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.easymock.MockControl; import org.easymock.MockControl;
/** /**
@ -82,13 +82,6 @@ public class DefaultWagonManagerTest
super.tearDown(); super.tearDown();
} }
public void testAvailableProtocols()
throws Exception
{
Set<String> protocols = wagonManager.getSupportProtocols();
System.out.println( protocols );
}
public void testUnnecessaryRepositoryLookup() throws Exception { public void testUnnecessaryRepositoryLookup() throws Exception {
Artifact artifact = createTestPomArtifact( "target/test-data/get-missing-pom" ); Artifact artifact = createTestPomArtifact( "target/test-data/get-missing-pom" );
@ -108,8 +101,7 @@ public class DefaultWagonManagerTest
} }
}; };
TransferListener listener = new TransferListener(); TransferListener listener = new TransferListener();
wagonManager.setDownloadMonitor(listener); wagonManager.getArtifact( artifact, repos, listener );
wagonManager.getArtifact( artifact, repos, listener, false );
assertEquals(1, listener.events.size()); assertEquals(1, listener.events.size());
} }
@ -126,11 +118,9 @@ public class DefaultWagonManagerTest
wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" ); wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
MockControl control = MockControl.createControl( UpdateCheckManager.class ); MockControl control = MockControl.createControl( UpdateCheckManager.class );
UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
control.replay(); control.replay();
wagonManager.getArtifact( artifact, repo, true ); wagonManager.getArtifact( artifact, repo, null );
assertTrue( artifact.getFile().exists() ); assertTrue( artifact.getFile().exists() );
assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) ); assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) );
@ -146,7 +136,7 @@ public class DefaultWagonManagerTest
try try
{ {
wagonManager.getArtifact( artifact, repo, false ); wagonManager.getArtifact( artifact, repo, null );
fail(); fail();
} }
@ -166,7 +156,7 @@ public class DefaultWagonManagerTest
try try
{ {
wagonManager.getArtifact( artifact, repo, true ); wagonManager.getArtifact( artifact, repo, null );
fail(); fail();
} }
@ -190,11 +180,9 @@ public class DefaultWagonManagerTest
wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" ); wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
MockControl control = MockControl.createControl( UpdateCheckManager.class ); MockControl control = MockControl.createControl( UpdateCheckManager.class );
UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
control.replay(); control.replay();
wagonManager.getArtifact( artifact, repo, false ); wagonManager.getArtifact( artifact, repo, null );
assertTrue( artifact.getFile().exists() ); assertTrue( artifact.getFile().exists() );
assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) ); assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) );
@ -215,11 +203,9 @@ public class DefaultWagonManagerTest
wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" ); wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
MockControl control = MockControl.createControl( UpdateCheckManager.class ); MockControl control = MockControl.createControl( UpdateCheckManager.class );
UpdateCheckManager updateCheckManager = (UpdateCheckManager) control.getMock();
control.replay(); control.replay();
wagonManager.getArtifact( artifact, repo, true ); wagonManager.getArtifact( artifact, repo, null );
assertTrue( artifact.getFile().exists() ); assertTrue( artifact.getFile().exists() );
assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) ); 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 * Check that transfer listeners are properly removed after getArtifact and putArtifact
*/ */
@ -345,8 +311,7 @@ public class DefaultWagonManagerTest
/* getArtifact */ /* getArtifact */
assertFalse( "Transfer listener is registered before test", assertFalse( "Transfer listener is registered before test",
wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
wagonManager.setDownloadMonitor( transferListener ); wagonManager.getArtifact( artifact, repo, transferListener);
wagonManager.getArtifact( artifact, repo );
assertFalse( "Transfer listener still registered after getArtifact", assertFalse( "Transfer listener still registered after getArtifact",
wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
@ -354,12 +319,9 @@ public class DefaultWagonManagerTest
File sampleFile = getTestFile( "target/test-file" ); File sampleFile = getTestFile( "target/test-file" );
FileUtils.fileWrite( sampleFile.getAbsolutePath(), "sample file" ); FileUtils.fileWrite( sampleFile.getAbsolutePath(), "sample file" );
assertFalse( "Transfer listener is registered before test", assertFalse( "Transfer listener is registered before test", wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); wagonManager.putArtifact( sampleFile, artifact, repo, transferListener );
wagonManager.setDownloadMonitor( transferListener ); assertFalse( "Transfer listener still registered after putArtifact", wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
wagonManager.putArtifact( sampleFile, artifact, repo );
assertFalse( "Transfer listener still registered after putArtifact",
wagon.getTransferEventSupport().hasTransferListener( transferListener ) );
} }
/** /**
@ -385,7 +347,7 @@ public class DefaultWagonManagerTest
try try
{ {
wagonManager.getArtifact( artifact, repo, true ); wagonManager.getArtifact( artifact, repo, null );
} }
catch ( ChecksumFailedException e ) catch ( ChecksumFailedException e )
{ {
@ -398,7 +360,7 @@ public class DefaultWagonManagerTest
try try
{ {
wagonManager.getArtifact( artifact, repo, true ); wagonManager.getArtifact( artifact, repo, null );
} }
catch ( ChecksumFailedException e ) catch ( ChecksumFailedException e )
{ {
@ -411,7 +373,7 @@ public class DefaultWagonManagerTest
try try
{ {
wagonManager.getArtifact( artifact, repo, true ); wagonManager.getArtifact( artifact, repo, null );
fail( "Checksum verification did not fail" ); fail( "Checksum verification did not fail" );
} }
catch ( ChecksumFailedException e ) catch ( ChecksumFailedException e )
@ -425,7 +387,7 @@ public class DefaultWagonManagerTest
try try
{ {
wagonManager.getArtifact( artifact, repo, true ); wagonManager.getArtifact( artifact, repo, null );
} }
catch ( ChecksumFailedException e ) catch ( ChecksumFailedException e )
{ {
@ -438,7 +400,7 @@ public class DefaultWagonManagerTest
try try
{ {
wagonManager.getArtifact( artifact, repo, true ); wagonManager.getArtifact( artifact, repo, null );
} }
catch ( ChecksumFailedException e ) catch ( ChecksumFailedException e )
{ {
@ -451,7 +413,7 @@ public class DefaultWagonManagerTest
try try
{ {
wagonManager.getArtifact( artifact, repo, true ); wagonManager.getArtifact( artifact, repo, null );
fail( "Checksum verification did not fail" ); fail( "Checksum verification did not fail" );
} }
catch ( ChecksumFailedException e ) catch ( ChecksumFailedException e )
@ -468,32 +430,6 @@ public class DefaultWagonManagerTest
assertNotNull( "Check wagon, protocol=" + protocol, wagon ); 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 private final class ArtifactRepositoryLayoutStub
implements ArtifactRepositoryLayout implements ArtifactRepositoryLayout
{ {

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.manager; package org.apache.maven.repository.legacy;
import org.apache.maven.wagon.Wagon; import org.apache.maven.wagon.Wagon;
import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Component;

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.manager; package org.apache.maven.repository.legacy;
import org.apache.maven.wagon.Wagon; import org.apache.maven.wagon.Wagon;
import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Component;

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.manager; package org.apache.maven.repository.legacy;
import org.apache.maven.wagon.Wagon; import org.apache.maven.wagon.Wagon;
import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Component;

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one

View File

@ -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 * 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.ArtifactMetadataSource;
import org.apache.maven.artifact.metadata.ResolutionGroup; import org.apache.maven.artifact.metadata.ResolutionGroup;
import org.apache.maven.artifact.repository.ArtifactRepository; 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.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter; import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; 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.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException; import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.repository.legacy.resolver.ArtifactCollector;
import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.PlexusTestCase;
/** /**

View File

@ -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 * 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.resolver.ResolutionNode;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver;
import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.PlexusTestCase;
/** /**

View File

@ -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 * 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 java.util.Collections;
import org.apache.maven.artifact.resolver.ResolutionNode; import org.apache.maven.artifact.resolver.ResolutionNode;
import org.apache.maven.repository.legacy.resolver.conflict.FarthestConflictResolver;
/** /**
* Tests <code>FarthestConflictResolver</code>. * Tests <code>FarthestConflictResolver</code>.

View File

@ -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 * 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 java.util.Collections;
import org.apache.maven.artifact.resolver.ResolutionNode; import org.apache.maven.artifact.resolver.ResolutionNode;
import org.apache.maven.repository.legacy.resolver.conflict.NearestConflictResolver;
/** /**
* Tests <code>NearestConflictResolver</code>. * Tests <code>NearestConflictResolver</code>.

View File

@ -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 * 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 java.util.Collections;
import org.apache.maven.artifact.resolver.ResolutionNode; import org.apache.maven.artifact.resolver.ResolutionNode;
import org.apache.maven.repository.legacy.resolver.conflict.NewestConflictResolver;
/** /**
* Tests <code>NewestConflictResolver</code>. * Tests <code>NewestConflictResolver</code>.

View File

@ -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 * 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 java.util.Collections;
import org.apache.maven.artifact.resolver.ResolutionNode; import org.apache.maven.artifact.resolver.ResolutionNode;
import org.apache.maven.repository.legacy.resolver.conflict.OldestConflictResolver;
/** /**
* Tests <code>OldestConflictResolver</code>. * Tests <code>OldestConflictResolver</code>.

View File

@ -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.ArtifactScopeEnum;
import org.apache.maven.artifact.resolver.metadata.ArtifactMetadata; import org.apache.maven.repository.metadata.ArtifactMetadata;
import org.apache.maven.artifact.resolver.metadata.MetadataGraph; import org.apache.maven.repository.metadata.ClasspathContainer;
import org.apache.maven.artifact.resolver.metadata.MetadataGraphEdge; import org.apache.maven.repository.metadata.ClasspathTransformation;
import org.apache.maven.artifact.resolver.metadata.MetadataGraphVertex; 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.PlexusTestCase;
/** /**

View File

@ -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; import org.codehaus.plexus.PlexusTestCase;
/** /**

View File

@ -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.ArtifactScopeEnum;
import org.apache.maven.artifact.resolver.metadata.ArtifactMetadata; import org.apache.maven.repository.metadata.ArtifactMetadata;
import org.apache.maven.artifact.resolver.metadata.MetadataGraph; import org.apache.maven.repository.metadata.GraphConflictResolver;
import org.apache.maven.artifact.resolver.metadata.MetadataGraphEdge; import org.apache.maven.repository.metadata.MetadataGraph;
import org.apache.maven.artifact.resolver.metadata.MetadataGraphVertex; import org.apache.maven.repository.metadata.MetadataGraphEdge;
import org.apache.maven.repository.metadata.MetadataGraphVertex;
import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.Logger;

View File

@ -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<ArtifactRepository> 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<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException
{
throw new UnsupportedOperationException( "Cannot get available versions in this test case" );
}
public List<ArtifactVersion> 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<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException
{
return artifact;
}
}