You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2009/02/25 19:28:15 UTC
svn commit: r747886 - in
/maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository:
LegacyMavenRepositorySystem.java MavenRepositorySystem.java
Author: jvanzyl
Date: Wed Feb 25 18:28:14 2009
New Revision: 747886
URL: http://svn.apache.org/viewvc?rev=747886&view=rev
Log:
o trying to decouple the interface from maven-project. we're stuck with MavenProject at the moment
Modified:
maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LegacyMavenRepositorySystem.java
maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/MavenRepositorySystem.java
Modified: maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LegacyMavenRepositorySystem.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LegacyMavenRepositorySystem.java?rev=747886&r1=747885&r2=747886&view=diff
==============================================================================
--- maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LegacyMavenRepositorySystem.java (original)
+++ maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LegacyMavenRepositorySystem.java Wed Feb 25 18:28:14 2009
@@ -31,6 +31,7 @@
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.metadata.ResolutionGroup;
@@ -72,9 +73,6 @@
implements MavenRepositorySystem
{
@Requirement
- private Logger logger;
-
- @Requirement
private ArtifactFactory artifactFactory;
@Requirement
@@ -87,8 +85,14 @@
private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
@Requirement
+ private WagonManager wagonManager;
+
+ @Requirement
private ArtifactMetadataSource artifactMetadataSource;
+ @Requirement
+ private Logger logger;
+
private static HashMap<String, Artifact> cache = new HashMap<String, Artifact>();
// Artifact Creation
@@ -124,7 +128,7 @@
{
return null;
}
-
+
return artifactFactory.createDependencyArtifact( groupId, artifactId, versionRange, type, classifier, scope );
}
@@ -139,7 +143,7 @@
{
return null;
}
-
+
return artifactFactory.createDependencyArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope );
}
@@ -156,8 +160,8 @@
}
return artifactFactory.createExtensionArtifact( groupId, artifactId, versionRange );
- }
-
+ }
+
public Artifact createParentArtifact( String groupId, String artifactId, String version )
{
return artifactFactory.createParentArtifact( groupId, artifactId, version );
@@ -174,7 +178,7 @@
{
return null;
}
-
+
return artifactFactory.createPluginArtifact( groupId, artifactId, versionRange );
}
@@ -344,7 +348,7 @@
// Taken from RepositoryHelper
public void findModelFromRepository( Artifact artifact, List remoteArtifactRepositories, ArtifactRepository localRepository )
- throws ProjectBuildingException
+ throws InvalidRepositoryException, ArtifactResolutionException, ArtifactNotFoundException
{
if ( cache.containsKey( artifact.getId() ) )
@@ -370,26 +374,15 @@
projectArtifact = artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getScope() );
}
- try
- {
- artifactResolver.resolve( projectArtifact, remoteArtifactRepositories, localRepository );
+ artifactResolver.resolve( projectArtifact, remoteArtifactRepositories, localRepository );
- File file = projectArtifact.getFile();
- artifact.setFile( file );
- cache.put( artifact.getId(), artifact );
- }
- catch ( ArtifactResolutionException e )
- {
- throw new ProjectBuildingException( projectId, "Error getting POM for '" + projectId + "' from the repository: " + e.getMessage(), e );
- }
- catch ( ArtifactNotFoundException e )
- {
- throw new ProjectBuildingException( projectId, "POM '" + projectId + "' not found in repository: " + e.getMessage(), e );
- }
+ File file = projectArtifact.getFile();
+ artifact.setFile( file );
+ cache.put( artifact.getId(), artifact );
}
private List normalizeToArtifactRepositories( List remoteArtifactRepositories, String projectId )
- throws ProjectBuildingException
+ throws InvalidRepositoryException
{
List normalized = new ArrayList( remoteArtifactRepositories.size() );
@@ -405,21 +398,14 @@
else if ( item instanceof Repository )
{
Repository repo = (Repository) item;
- try
- {
- item = buildArtifactRepository( repo );
+ item = buildArtifactRepository( repo );
- normalized.add( item );
- normalizationNeeded = true;
- }
- catch ( InvalidRepositoryException e )
- {
- throw new ProjectBuildingException( projectId, "Error building artifact repository for id: " + repo.getId(), e );
- }
+ normalized.add( item );
+ normalizationNeeded = true;
}
else
{
- throw new ProjectBuildingException( projectId, "Error building artifact repository from non-repository information item: " + item );
+ throw new InvalidRepositoryException( projectId, "Error building artifact repository from non-repository information item: " + item );
}
}
@@ -467,8 +453,8 @@
public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
{
return artifactResolver.resolve( request );
- }
-
+ }
+
// ------------------------------------------------------------------------
// Extracted from DefaultWagonManager
// ------------------------------------------------------------------------
Modified: maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/MavenRepositorySystem.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/MavenRepositorySystem.java?rev=747886&r1=747885&r2=747886&view=diff
==============================================================================
--- maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/MavenRepositorySystem.java (original)
+++ maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/MavenRepositorySystem.java Wed Feb 25 18:28:14 2009
@@ -49,9 +49,6 @@
public interface MavenRepositorySystem
extends ArtifactMetadataSource // This needs to be removed
{
- // More then one "local" repository is required, could be layered locals or workspaces
- // Remove ResolutionGroup
- // Only have one resolve() method
// Artifact creation: This needs to be reduced to fewer, if not one, method.
Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type );
@@ -71,7 +68,7 @@
Artifact createDependencyArtifact( String groupId, String artifactId, String version, String type, String classifier, String scope, boolean optional );
Artifact createDependencyArtifact( String groupId, String artifactId, String version, String type, String classifier, String scope, String inheritedScope );
-
+
Set<Artifact> createArtifacts( List<Dependency> dependencies, String inheritedScope, ArtifactFilter dependencyFilter, MavenProject project )
throws InvalidDependencyVersionException;
@@ -84,8 +81,7 @@
// maven model
ArtifactRepository buildArtifactRepository( Repository repository )
throws InvalidRepositoryException;
-
- // Just use a File here
+
ArtifactRepository createLocalRepository( String url, String repositoryId )
throws IOException;
@@ -97,6 +93,8 @@
// Artifact resolution
+ //MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request );
+
ArtifactResolutionResult resolve( ArtifactResolutionRequest request );
// This can be reduced to the request/result
@@ -104,7 +102,7 @@
throws ArtifactResolutionException, ArtifactNotFoundException;
void findModelFromRepository( Artifact artifact, List remoteArtifactRepositories, ArtifactRepository localRepository )
- throws ProjectBuildingException;
+ throws InvalidRepositoryException, ArtifactResolutionException, ArtifactNotFoundException;
// Version retrieval or metadata operations
@@ -113,14 +111,14 @@
List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException;
-
+
// These are only showing up in tests, not called from anywhere else in the core
public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository )
throws ArtifactMetadataRetrievalException;
public Artifact retrieveRelocatedArtifact( Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
throws ArtifactMetadataRetrievalException;
-
+
// Mirrors
ArtifactRepository getMirrorRepository( ArtifactRepository repository );
@@ -134,11 +132,11 @@
void addMirror( String id, String mirrorOf, String url );
// Network enablement
-
+
void setOnline( boolean online );
boolean isOnline();
-
+
// This doesn't belong here
void setInteractive( boolean interactive );