You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/13 11:13:35 UTC

svn commit: r320701 - in /maven/components/trunk: maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/ maven-core/src/main/java/org/apache/maven/plugin/ maven-core/src/main/java/org/apache/maven/plugin/version/ maven-plugins/maven-deploy-plu...

Author: brett
Date: Thu Oct 13 02:13:11 2005
New Revision: 320701

URL: http://svn.apache.org/viewcvs?rev=320701&view=rev
Log:
PR: MNG-122
cleanup artifact metadata retrieval exceptions

Modified:
    maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java
    maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
    maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
    maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
    maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java

Modified: maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java?rev=320701&r1=320700&r2=320701&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java (original)
+++ maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DeployTask.java Thu Oct 13 02:13:11 2005
@@ -118,8 +118,8 @@
         }
         catch ( ArtifactDeploymentException e )
         {
-            // TODO: deployment exception that does not give a trace
-            throw new BuildException( "Error deploying artifact", e );
+            throw new BuildException(
+                "Error deploying artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
         }
     }
 

Modified: maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java?rev=320701&r1=320700&r2=320701&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java (original)
+++ maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/InstallTask.java Thu Oct 13 02:13:11 2005
@@ -69,8 +69,8 @@
         }
         catch ( ArtifactInstallationException e )
         {
-            // TODO: install exception that does not give a trace
-            throw new BuildException( "Error installing artifact", e );
+            throw new BuildException(
+                "Error installing artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
         }
     }
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=320701&r1=320700&r2=320701&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Thu Oct 13 02:13:11 2005
@@ -440,7 +440,8 @@
     }
 
     public MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenSession session )
-        throws ArtifactNotFoundException, PluginConfigurationException, PluginManagerException
+        throws ArtifactNotFoundException, PluginConfigurationException, PluginManagerException,
+        ArtifactResolutionException
     {
         MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
         PluginDescriptor descriptor = mojoDescriptor.getPluginDescriptor();
@@ -495,7 +496,8 @@
 
     private Mojo getConfiguredMojo( MavenSession session, Xpp3Dom dom, MavenProject project, boolean report,
                                     MojoExecution mojoExecution )
-        throws PluginConfigurationException, ArtifactNotFoundException, PluginManagerException
+        throws PluginConfigurationException, ArtifactNotFoundException, PluginManagerException,
+        ArtifactResolutionException
     {
         MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
@@ -570,7 +572,7 @@
 
     private void ensurePluginContainerIsComplete( PluginDescriptor pluginDescriptor, PlexusContainer pluginContainer,
                                                   MavenProject project, MavenSession session )
-        throws PluginConfigurationException, ArtifactNotFoundException
+        throws ArtifactNotFoundException, PluginManagerException, ArtifactResolutionException
     {
         // if the plugin's already been used once, don't re-do this step...
         // otherwise, we have to finish resolving the plugin's classpath and start the container.
@@ -578,64 +580,66 @@
         {
             Artifact pluginArtifact = (Artifact) pluginDescriptor.getArtifacts().get( 0 );
 
+            ArtifactRepository localRepository = session.getLocalRepository();
+
+            ResolutionGroup resolutionGroup;
             try
             {
-                ArtifactRepository localRepository = session.getLocalRepository();
+                resolutionGroup = artifactMetadataSource.retrieve( pluginArtifact, localRepository,
+                                                                   project.getPluginArtifactRepositories() );
+            }
+            catch ( ArtifactMetadataRetrievalException e )
+            {
+                throw new ArtifactResolutionException( "Unable to download metadata from repository for plugin '" +
+                    pluginArtifact.getId() + "': " + e.getMessage(), pluginArtifact, e );
+            }
 
-                ResolutionGroup resolutionGroup = artifactMetadataSource.retrieve( pluginArtifact, localRepository,
-                                                                                   project.getPluginArtifactRepositories() );
+            Set dependencies = new HashSet( resolutionGroup.getArtifacts() );
 
-                Set dependencies = new HashSet( resolutionGroup.getArtifacts() );
+            dependencies.addAll( pluginDescriptor.getIntroducedDependencyArtifacts() );
 
-                dependencies.addAll( pluginDescriptor.getIntroducedDependencyArtifacts() );
+            ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, pluginArtifact,
+                                                                                    localRepository,
+                                                                                    resolutionGroup.getResolutionRepositories(),
+                                                                                    artifactMetadataSource,
+                                                                                    artifactFilter );
 
-                ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, pluginArtifact,
-                                                                                        localRepository,
-                                                                                        resolutionGroup.getResolutionRepositories(),
-                                                                                        artifactMetadataSource,
-                                                                                        artifactFilter );
+            Set resolved = result.getArtifacts();
 
-                Set resolved = result.getArtifacts();
+            for ( Iterator it = resolved.iterator(); it.hasNext(); )
+            {
+                Artifact artifact = (Artifact) it.next();
 
-                for ( Iterator it = resolved.iterator(); it.hasNext(); )
+                if ( !artifact.equals( pluginArtifact ) )
                 {
-                    Artifact artifact = (Artifact) it.next();
+                    artifact = project.replaceWithActiveArtifact( artifact );
 
-                    if ( !artifact.equals( pluginArtifact ) )
+                    try
                     {
-                        artifact = project.replaceWithActiveArtifact( artifact );
-
                         pluginContainer.addJarResource( artifact.getFile() );
                     }
+                    catch ( PlexusContainerException e )
+                    {
+                        throw new PluginManagerException( "Error adding plugin dependency '" +
+                            artifact.getDependencyConflictId() + "' into plugin manager: " + e.getMessage(), e );
+                    }
                 }
+            }
 
-                pluginDescriptor.setClassRealm( pluginContainer.getContainerRealm() );
+            pluginDescriptor.setClassRealm( pluginContainer.getContainerRealm() );
 
-                List unresolved = new ArrayList( dependencies );
+            List unresolved = new ArrayList( dependencies );
 
-                unresolved.removeAll( resolved );
+            unresolved.removeAll( resolved );
 
-                resolveCoreArtifacts( unresolved, localRepository, resolutionGroup.getResolutionRepositories() );
+            resolveCoreArtifacts( unresolved, localRepository, resolutionGroup.getResolutionRepositories() );
 
-                List allResolved = new ArrayList( resolved.size() + unresolved.size() );
+            List allResolved = new ArrayList( resolved.size() + unresolved.size() );
 
-                allResolved.addAll( resolved );
-                allResolved.addAll( unresolved );
+            allResolved.addAll( resolved );
+            allResolved.addAll( unresolved );
 
-                pluginDescriptor.setArtifacts( allResolved );
-            }
-            catch ( ArtifactResolutionException e )
-            {
-                throw new PluginConfigurationException( pluginDescriptor, "Cannot resolve plugin dependencies", e );
-            }
-            catch ( PlexusContainerException e )
-            {
-                throw new PluginConfigurationException( pluginDescriptor, "Cannot start plugin container", e );
-            }
-            catch ( ArtifactMetadataRetrievalException e )
-            {
-                throw new PluginConfigurationException( pluginDescriptor, "Cannot resolve plugin dependencies", e );
-            }
+            pluginDescriptor.setArtifacts( allResolved );
         }
     }
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java?rev=320701&r1=320700&r2=320701&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java Thu Oct 13 02:13:11 2005
@@ -46,7 +46,8 @@
         InvalidDependencyVersionException, PluginManagerException;
 
     MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenSession session )
-        throws ArtifactNotFoundException, PluginConfigurationException, PluginManagerException;
+        throws ArtifactNotFoundException, PluginConfigurationException, PluginManagerException,
+        ArtifactResolutionException;
 
     PluginDescriptor getPluginDescriptorForPrefix( String prefix );
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java?rev=320701&r1=320700&r2=320701&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java Thu Oct 13 02:13:11 2005
@@ -624,11 +624,13 @@
             }
             catch ( IOException e )
             {
-                throw new PluginVersionResolutionException( groupId, artifactId, "Cannot read plugin registry", e );
+                throw new PluginVersionResolutionException( groupId, artifactId,
+                                                            "Error readin plugin registry: " + e.getMessage(), e );
             }
             catch ( XmlPullParserException e )
             {
-                throw new PluginVersionResolutionException( groupId, artifactId, "Cannot parse plugin registry", e );
+                throw new PluginVersionResolutionException( groupId, artifactId,
+                                                            "Error parsing plugin registry: " + e.getMessage(), e );
             }
 
             if ( pluginRegistry == null )
@@ -648,6 +650,7 @@
 
         String version = null;
 
+        // This takes the spec version and resolves a real version
         try
         {
             ResolutionGroup resolutionGroup =
@@ -656,45 +659,50 @@
             // switching this out with the actual resolved artifact instance, since the MMSource re-creates the pom
             // artifact.
             artifact = resolutionGroup.getPomArtifact();
+        }
+        catch ( ArtifactMetadataRetrievalException e )
+        {
+            throw new PluginVersionResolutionException( groupId, artifactId, e.getMessage(), e );
+        }
 
-            // make sure this artifact was actually resolved to a file in the repo...
-            if ( artifact.getFile() != null )
+        // make sure this artifact was actually resolved to a file in the repo...
+        if ( artifact.getFile() != null )
+        {
+            MavenProject pluginProject;
+            try
             {
-                MavenProject pluginProject = mavenProjectBuilder.buildFromRepository( artifact, project
-                    .getPluginArtifactRepositories(), localRepository, false );
+                pluginProject = mavenProjectBuilder.buildFromRepository( artifact,
+                                                                         project.getPluginArtifactRepositories(),
+                                                                         localRepository, false );
+            }
+            catch ( ProjectBuildingException e )
+            {
+                throw new PluginVersionResolutionException( groupId, artifactId,
+                                                            "Unable to build resolve plugin project information", e );
+            }
 
-                boolean pluginValid = true;
+            boolean pluginValid = true;
 
-                // if we don't have the required Maven version, then ignore an update
-                if ( pluginProject.getPrerequisites() != null && pluginProject.getPrerequisites().getMaven() != null )
-                {
-                    DefaultArtifactVersion requiredVersion =
-                        new DefaultArtifactVersion( pluginProject.getPrerequisites().getMaven() );
+            // if we don't have the required Maven version, then ignore an update
+            if ( pluginProject.getPrerequisites() != null && pluginProject.getPrerequisites().getMaven() != null )
+            {
+                DefaultArtifactVersion requiredVersion =
+                    new DefaultArtifactVersion( pluginProject.getPrerequisites().getMaven() );
 
-                    if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) < 0 )
-                    {
-                        getLogger().info( "Ignoring available plugin update: " + artifact.getVersion() +
-                            " as it requires Maven version " + requiredVersion );
-                        pluginValid = false;
-                    }
+                if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) < 0 )
+                {
+                    getLogger().info( "Ignoring available plugin update: " + artifact.getVersion() +
+                        " as it requires Maven version " + requiredVersion );
+                    pluginValid = false;
                 }
+            }
 
-                String artifactVersion = artifact.getVersion();
+            String artifactVersion = artifact.getVersion();
 
-                if ( pluginValid && !metaVersionId.equals( artifactVersion ) )
-                {
-                    version = artifactVersion;
-                }
+            if ( pluginValid && !metaVersionId.equals( artifactVersion ) )
+            {
+                version = artifactVersion;
             }
-        }
-        catch ( ArtifactMetadataRetrievalException e )
-        {
-            getLogger().debug( "Failed to resolve " + metaVersionId + " version", e );
-        }
-        catch ( ProjectBuildingException e )
-        {
-            throw new PluginVersionResolutionException( groupId, artifactId,
-                                                        "Unable to build resolve plugin project information", e );
         }
 
         return version;

Modified: maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java?rev=320701&r1=320700&r2=320701&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java Thu Oct 13 02:13:11 2005
@@ -156,8 +156,8 @@
         }
         catch ( ArtifactDeploymentException e )
         {
-            // TODO: deployment exception that does not give a trace
-            throw new MojoExecutionException( "Error deploying artifact", e );
+            throw new MojoExecutionException(
+                "Error deploying artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
         }
     }
 }

Modified: maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=320701&r1=320700&r2=320701&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java Thu Oct 13 02:13:11 2005
@@ -30,7 +30,7 @@
  * @version $Id$
  * @goal install-file
  * @requiresProject false
- * @aggregator 
+ * @aggregator
  */
 public class InstallFileMojo
     extends AbstractInstallMojo
@@ -90,8 +90,8 @@
         }
         catch ( ArtifactInstallationException e )
         {
-            // TODO: install exception that does not give a trace
-            throw new MojoExecutionException( "Error installing artifact", e );
+            throw new MojoExecutionException(
+                "Error installing artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
         }
     }
 }

Modified: maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java?rev=320701&r1=320700&r2=320701&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java Thu Oct 13 02:13:11 2005
@@ -125,8 +125,8 @@
         }
         catch ( ArtifactInstallationException e )
         {
-            // TODO: install exception that does not give a trace
-            throw new MojoExecutionException( "Error installing artifact", e );
+            throw new MojoExecutionException(
+                "Error installing artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
         }
     }
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=320701&r1=320700&r2=320701&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java Thu Oct 13 02:13:11 2005
@@ -27,7 +27,6 @@
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
 import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
@@ -43,15 +42,9 @@
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -118,7 +111,8 @@
                 }
                 catch ( ProjectBuildingException e )
                 {
-                    throw new ArtifactMetadataRetrievalException( "Unable to read the metadata file", e );
+                    throw new ArtifactMetadataRetrievalException( "Unable to read the metadata file for artifact '" +
+                        artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
                 }
 
                 if ( project != null )
@@ -172,52 +166,56 @@
         // TODO: this could come straight from the project, negating the need to set it in the project itself?
         artifact.setDownloadUrl( pomArtifact.getDownloadUrl() );
 
-        try
-        {
-            ResolutionGroup result;
+        ResolutionGroup result;
 
-            if ( project == null )
+        if ( project == null )
+        {
+            // if the project is null, we encountered an invalid model (read: m1 POM)
+            // we'll just return an empty resolution group.
+            // or used the inherited scope (should that be passed to the buildFromRepository method above?)
+            result = new ResolutionGroup( pomArtifact, Collections.EMPTY_SET, Collections.EMPTY_LIST );
+        }
+        else
+        {
+            Set artifacts = Collections.EMPTY_SET;
+            if ( !artifact.getArtifactHandler().isIncludesDependencies() )
             {
-                // if the project is null, we encountered an invalid model (read: m1 POM)
-                // we'll just return an empty resolution group.
+                // TODO: we could possibly use p.getDependencyArtifacts instead of this call, but they haven't been filtered
                 // or used the inherited scope (should that be passed to the buildFromRepository method above?)
-                result = new ResolutionGroup( pomArtifact, Collections.EMPTY_SET, Collections.EMPTY_LIST );
-            }
-            else
-            {
-                Set artifacts = Collections.EMPTY_SET;
-                if ( !artifact.getArtifactHandler().isIncludesDependencies() )
+                try
                 {
-                    // TODO: we could possibly use p.getDependencyArtifacts instead of this call, but they haven't been filtered
-                    // or used the inherited scope (should that be passed to the buildFromRepository method above?)
                     artifacts =
                         project.createArtifacts( artifactFactory, artifact.getScope(), artifact.getDependencyFilter() );
                 }
-
-                List repositories =
-                    aggregateRepositoryLists( remoteRepositories, project.getRemoteArtifactRepositories() );
-
-                result = new ResolutionGroup( pomArtifact, artifacts, repositories );
+                catch ( InvalidDependencyVersionException e )
+                {
+                    throw new ArtifactMetadataRetrievalException( "Error in metadata for artifact '" +
+                        artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
+                }
             }
 
-            return result;
-        }
-        catch ( ProjectBuildingException e )
-        {
-            throw new ArtifactMetadataRetrievalException( "Unable to read the metadata file", e );
-        }
-        catch ( InvalidDependencyVersionException e )
-        {
-            throw new ArtifactMetadataRetrievalException( "Unable to read the metadata file", e );
+            List repositories = aggregateRepositoryLists( remoteRepositories, project.getRemoteArtifactRepositories() );
+
+            result = new ResolutionGroup( pomArtifact, artifacts, repositories );
         }
+
+        return result;
     }
 
     private List aggregateRepositoryLists( List remoteRepositories, List remoteArtifactRepositories )
-        throws ProjectBuildingException
+        throws ArtifactMetadataRetrievalException
     {
         if ( superProject == null )
         {
-            superProject = mavenProjectBuilder.buildStandaloneSuperProject( null );
+            try
+            {
+                superProject = mavenProjectBuilder.buildStandaloneSuperProject( null );
+            }
+            catch ( ProjectBuildingException e )
+            {
+                throw new ArtifactMetadataRetrievalException(
+                    "Unable to parse the Maven built-in model: " + e.getMessage(), e );
+            }
         }
 
         List repositories = new ArrayList();
@@ -371,41 +369,5 @@
         }
 
         return versions;
-    }
-
-    /**
-     * @todo share with DefaultPluginMappingManager.
-     */
-    private static Metadata readMetadata( File mappingFile )
-        throws ArtifactMetadataRetrievalException
-    {
-        Metadata result;
-
-        Reader fileReader = null;
-        try
-        {
-            fileReader = new FileReader( mappingFile );
-
-            MetadataXpp3Reader mappingReader = new MetadataXpp3Reader();
-
-            result = mappingReader.read( fileReader );
-        }
-        catch ( FileNotFoundException e )
-        {
-            throw new ArtifactMetadataRetrievalException( "Cannot read version information from: " + mappingFile, e );
-        }
-        catch ( IOException e )
-        {
-            throw new ArtifactMetadataRetrievalException( "Cannot read version information from: " + mappingFile, e );
-        }
-        catch ( XmlPullParserException e )
-        {
-            throw new ArtifactMetadataRetrievalException( "Cannot parse version information from: " + mappingFile, e );
-        }
-        finally
-        {
-            IOUtil.close( fileReader );
-        }
-        return result;
     }
 }