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

svn commit: r312827 - in /maven/components/trunk: maven-core-it/it0045/ maven-core-it/it0046/ maven-core-it/it0051/ maven-core-it/it0052/ maven-core-it/it0053/ maven-core/src/main/java/org/apache/maven/ maven-core/src/main/java/org/apache/maven/cli/ ma...

Author: jdcasey
Date: Tue Oct 11 00:35:33 2005
New Revision: 312827

URL: http://svn.apache.org/viewcvs?rev=312827&view=rev
Log:
Resolving: MNG-449, MNG-152, MNG-1090, MNG-1089, MNG-1122

o Removed -cpl and related command line switches for controlling use of LATEST metadata for resolving plugin versions
o Made LATEST the only metadata used to resolve plugin versions, since this is also available when releases are performed
o Added various error diagnostics for project build exceptions
o Enhanced artifact not found error diagnostics
o Removed maven-project and added maven-artifact to maven-surefire-plugin's pom
o Removed the stanza that added pluginArtifacts to the test-booter's classpath...they are already covered by the classpathElements
o Fixed ITs in connection to the removal of -cpl
o Changed the plugin manager to detect whether a plugin's artifact file has changed since the plugin container was created...if so, reload it.
o Took the projecthelp plugin out of the build until I can diagnose the problems with its build (probably tomorrow).


Added:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java   (with props)
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java   (with props)
Removed:
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/InvalidModelException.java
Modified:
    maven/components/trunk/maven-core-it/it0045/cli-options.txt
    maven/components/trunk/maven-core-it/it0046/cli-options.txt
    maven/components/trunk/maven-core-it/it0051/cli-options.txt
    maven/components/trunk/maven-core-it/it0052/cli-options.txt
    maven/components/trunk/maven-core-it/it0053/cli-options.txt
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.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/version/DefaultPluginVersionManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
    maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
    maven/components/trunk/maven-mboot2/src/main/java/download/ArtifactDownloader.java
    maven/components/trunk/maven-mboot2/src/main/java/download/RepositoryMetadata.java
    maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
    maven/components/trunk/maven-plugins/maven-surefire-plugin/pom.xml
    maven/components/trunk/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java
    maven/components/trunk/maven-plugins/pom.xml
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
    maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java

Modified: maven/components/trunk/maven-core-it/it0045/cli-options.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0045/cli-options.txt?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/it0045/cli-options.txt (original)
+++ maven/components/trunk/maven-core-it/it0045/cli-options.txt Tue Oct 11 00:35:33 2005
@@ -1 +1 @@
---no-plugin-registry --check-plugin-latest
+--no-plugin-registry

Modified: maven/components/trunk/maven-core-it/it0046/cli-options.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0046/cli-options.txt?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/it0046/cli-options.txt (original)
+++ maven/components/trunk/maven-core-it/it0046/cli-options.txt Tue Oct 11 00:35:33 2005
@@ -1 +1 @@
---no-plugin-registry --check-plugin-latest --fail-never
+--no-plugin-registry --fail-never

Modified: maven/components/trunk/maven-core-it/it0051/cli-options.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0051/cli-options.txt?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/it0051/cli-options.txt (original)
+++ maven/components/trunk/maven-core-it/it0051/cli-options.txt Tue Oct 11 00:35:33 2005
@@ -1 +1 @@
---check-plugin-latest --no-plugin-registry -DperformRelease=true
+--no-plugin-registry -DperformRelease=true

Modified: maven/components/trunk/maven-core-it/it0052/cli-options.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0052/cli-options.txt?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/it0052/cli-options.txt (original)
+++ maven/components/trunk/maven-core-it/it0052/cli-options.txt Tue Oct 11 00:35:33 2005
@@ -1 +1 @@
---check-plugin-latest --no-plugin-registry
+--no-plugin-registry

Modified: maven/components/trunk/maven-core-it/it0053/cli-options.txt
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it/it0053/cli-options.txt?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it/it0053/cli-options.txt (original)
+++ maven/components/trunk/maven-core-it/it0053/cli-options.txt Tue Oct 11 00:35:33 2005
@@ -1 +1 @@
---check-plugin-latest --no-plugin-registry
+--no-plugin-registry

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Tue Oct 11 00:35:33 2005
@@ -448,7 +448,7 @@
                 DefaultArtifactVersion version = new DefaultArtifactVersion( project.getPrerequisites().getMaven() );
                 if ( runtimeInformation.getApplicationVersion().compareTo( version ) < 0 )
                 {
-                    throw new ProjectBuildingException( "Unable to build project '" + project.getFile() +
+                    throw new ProjectBuildingException( project.getId(), "Unable to build project '" + project.getFile() +
                         "; it requires Maven version " + version.toString() );
                 }
             }
@@ -500,7 +500,7 @@
             if ( pom.length() == 0 )
             {
                 throw new ProjectBuildingException(
-                    "The file " + pom.getAbsolutePath() + " you specified has zero length." );
+                    "unknown", "The file " + pom.getAbsolutePath() + " you specified has zero length." );
             }
         }
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java Tue Oct 11 00:35:33 2005
@@ -350,15 +350,6 @@
             runtimeInfo.setPluginUpdateOverride( Boolean.FALSE );
         }
 
-        if ( commandLine.hasOption( CLIManager.FORCE_PLUGIN_LATEST_CHECK ) )
-        {
-            runtimeInfo.setCheckLatestPluginVersion( Boolean.TRUE );
-        }
-        else if ( commandLine.hasOption( CLIManager.SUPPRESS_PLUGIN_LATEST_CHECK ) )
-        {
-            runtimeInfo.setCheckLatestPluginVersion( Boolean.FALSE );
-        }
-
         return runtimeInfo;
     }
 
@@ -633,10 +624,6 @@
 
         public static final String SUPPRESS_PLUGIN_REGISTRY = "npr";
 
-        public static final String FORCE_PLUGIN_LATEST_CHECK = "cpl";
-
-        public static final String SUPPRESS_PLUGIN_LATEST_CHECK = "npl";
-
         public static final char CHECKSUM_FAILURE_POLICY = 'C';
 
         public static final char CHECKSUM_WARNING_POLICY = 'c';
@@ -661,8 +648,6 @@
                     SET_SYSTEM_PROPERTY ) );
             options.addOption(
                 OptionBuilder.withLongOpt( "offline" ).withDescription( "Work offline" ).create( OFFLINE ) );
-//            options.addOption( OptionBuilder.withLongOpt( "mojoDescriptors" ).withDescription(
-//                "Display available mojoDescriptors" ).create( LIST_GOALS ) );
             options.addOption(
                 OptionBuilder.withLongOpt( "help" ).withDescription( "Display help information" ).create( HELP ) );
             options.addOption(
@@ -692,11 +677,7 @@
                 "Synonym for " + FORCE_PLUGIN_UPDATES ).create( FORCE_PLUGIN_UPDATES2 ) );
             options.addOption( OptionBuilder.withLongOpt( "no-plugin-updates" ).withDescription(
                 "Suppress upToDate check for any relevant registered plugins" ).create( SUPPRESS_PLUGIN_UPDATES ) );
-            options.addOption( OptionBuilder.withLongOpt( "check-plugin-latest" ).withDescription(
-                "Force checking of LATEST metadata for plugin versions" ).create( FORCE_PLUGIN_LATEST_CHECK ) );
-            options.addOption( OptionBuilder.withLongOpt( "no-plugin-latest" ).withDescription(
-                "Suppress checking of LATEST metadata for plugin versions" ).create( SUPPRESS_PLUGIN_LATEST_CHECK ) );
-
+            
             options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription(
                 "Don't use ~/.m2/plugin-registry.xml for plugin versions" ).create( SUPPRESS_PLUGIN_REGISTRY ) );
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Tue Oct 11 00:35:33 2005
@@ -106,6 +106,8 @@
     public MavenExecutionResponse execute( MavenSession session, ReactorManager rm, EventDispatcher dispatcher )
         throws LifecycleExecutionException
     {
+        // TODO: This is dangerous, particularly when it's just a collection of loose-leaf projects being built
+        // within the same reactor (using an inclusion pattern to gather them up)...
         MavenProject rootProject = rm.getTopLevelProject();
 
         List goals = session.getGoals();

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=312827&r1=312826&r2=312827&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 Tue Oct 11 00:35:33 2005
@@ -171,51 +171,73 @@
         // FIXME: need to find out how a plugin gets marked as 'installed'
         // and no ChildContainer exists. The check for that below fixes
         // the 'Can't find plexus container for plugin: xxx' error.
-        if ( !pluginCollector.isPluginInstalled( plugin ) || container.getChildContainer( plugin.getKey() ) == null )
+        try
         {
-            try
-            {
-                VersionRange versionRange = VersionRange.createFromVersionSpec( plugin.getVersion() );
+            VersionRange versionRange = VersionRange.createFromVersionSpec( plugin.getVersion() );
 
-                List remoteRepositories = new ArrayList();
-                remoteRepositories.addAll( project.getPluginArtifactRepositories() );
-                remoteRepositories.addAll( project.getRemoteArtifactRepositories() );
+            List remoteRepositories = new ArrayList();
+            remoteRepositories.addAll( project.getPluginArtifactRepositories() );
+            remoteRepositories.addAll( project.getRemoteArtifactRepositories() );
+
+            checkRequiredMavenVersion( plugin, localRepository, remoteRepositories );
+            
+            Artifact pluginArtifact = artifactFactory.createPluginArtifact( plugin.getGroupId(),
+                                                                            plugin.getArtifactId(), versionRange );
+            
+            pluginArtifact = project.replaceWithActiveArtifact( pluginArtifact );
 
-                checkRequiredMavenVersion( plugin, localRepository, remoteRepositories );
+            artifactResolver.resolve( pluginArtifact, project.getPluginArtifactRepositories(), localRepository );
 
-                Artifact pluginArtifact = artifactFactory.createPluginArtifact( plugin.getGroupId(),
-                                                                                plugin.getArtifactId(), versionRange );
-                addPlugin( plugin, pluginArtifact, project, localRepository );
+            if ( !pluginArtifact.isResolved() )
+            {
+                throw new PluginContainerException( plugin, "Cannot resolve artifact for plugin." );
+            }
 
-                project.addPlugin( plugin );
+            PlexusContainer pluginContainer = container.getChildContainer( plugin.getKey() );
+            
+            File pluginFile = pluginArtifact.getFile();
+            
+            if ( !pluginCollector.isPluginInstalled( plugin ) || pluginContainer == null )
+            {
+                addPlugin( plugin, pluginArtifact, project, localRepository );
             }
-            catch ( ArtifactNotFoundException e )
+            else if ( pluginFile.lastModified() > pluginContainer.getCreationDate().getTime() )
             {
-                String groupId = plugin.getGroupId();
-                String artifactId = plugin.getArtifactId();
-                String version = plugin.getVersion();
+                getLogger().info( "Reloading plugin container for: " + plugin.getKey() + ". The plugin artifact has changed." );
+                
+                pluginContainer.dispose();
+                
+                addPlugin( plugin, pluginArtifact, project, localRepository );
+            }
 
-                if ( groupId == null || artifactId == null || version == null )
-                {
-                    throw new PluginNotFoundException( e );
-                }
-                else if ( groupId.equals( e.getGroupId() ) && artifactId.equals( e.getArtifactId() ) &&
-                    version.equals( e.getVersion() ) && "maven-plugin".equals( e.getType() ) )
-                {
-                    throw new PluginNotFoundException( e );
-                }
-                else
-                {
-                    throw e;
-                }
+            project.addPlugin( plugin );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            String groupId = plugin.getGroupId();
+            String artifactId = plugin.getArtifactId();
+            String version = plugin.getVersion();
+
+            if ( groupId == null || artifactId == null || version == null )
+            {
+                throw new PluginNotFoundException( e );
+            }
+            else if ( groupId.equals( e.getGroupId() ) && artifactId.equals( e.getArtifactId() ) &&
+                version.equals( e.getVersion() ) && "maven-plugin".equals( e.getType() ) )
+            {
+                throw new PluginNotFoundException( e );
             }
-            catch ( InvalidVersionSpecificationException e )
+            else
             {
-                throw new PluginVersionResolutionException( plugin.getGroupId(), plugin.getArtifactId(),
-                                                            "Invalid version specification", e );
+                throw e;
             }
         }
-
+        catch ( InvalidVersionSpecificationException e )
+        {
+            throw new PluginVersionResolutionException( plugin.getGroupId(), plugin.getArtifactId(),
+                                                        "Invalid version specification", e );
+        }
+        
         return pluginCollector.getPluginDescriptor( plugin );
     }
 
@@ -259,15 +281,6 @@
                               ArtifactRepository localRepository )
         throws ArtifactResolutionException, PluginManagerException, ArtifactNotFoundException
     {
-        pluginArtifact = project.replaceWithActiveArtifact( pluginArtifact );
-
-        artifactResolver.resolve( pluginArtifact, project.getPluginArtifactRepositories(), localRepository );
-
-        if ( !pluginArtifact.isResolved() )
-        {
-            throw new PluginContainerException( plugin, "Cannot resolve artifact for plugin." );
-        }
-
         PlexusContainer child;
         try
         {
@@ -380,7 +393,7 @@
         }
         catch ( ComponentLookupException e )
         {
-            throw new MojoExecutionException( "Error looking up plugin: ", e );
+            throw new MojoExecutionException( "Error looking up mojo: " + goalName, e );
         }
 
         // Event monitoring.
@@ -503,6 +516,7 @@
         {
             throw new PluginManagerException( "Cannot find PlexusContainer for plugin: " + pluginKey );
         }
+        
         return pluginContainer;
     }
 

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=312827&r1=312826&r2=312827&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 Tue Oct 11 00:35:33 2005
@@ -50,7 +50,6 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 public class DefaultPluginVersionManager
@@ -65,7 +64,7 @@
 
     private ArtifactMetadataSource artifactMetadataSource;
 
-    // calculated.
+    // TODO: [jc] Revisit to remove this piece of state. PLUGIN REGISTRY MAY BE UPDATED ON DISK OUT-OF-PROCESS!
     private PluginRegistry pluginRegistry;
 
     private MavenProjectBuilder mavenProjectBuilder;
@@ -90,14 +89,6 @@
                                          ArtifactRepository localRepository, boolean resolveAsReportPlugin )
         throws PluginVersionResolutionException
     {
-        // before we do anything else, if this is a self-reference we need to short-circuit the resolution process.
-        String projectKey = constructPluginKey( project.getGroupId(), project.getArtifactId() );
-
-        if ( projectKey.equals( constructPluginKey( groupId, artifactId ) ) )
-        {
-            return project.getVersion();
-        }
-
         // first pass...if the plugin is specified in the pom, try to retrieve the version from there.
         String version = getVersionFromPluginConfig( groupId, artifactId, project, resolveAsReportPlugin );
 
@@ -130,8 +121,8 @@
                 if ( Boolean.TRUE.equals( pluginUpdateOverride ) ||
                     ( !Boolean.FALSE.equals( pluginUpdateOverride ) && shouldCheckForUpdates( groupId, artifactId ) ) )
                 {
-                    updatedVersion = resolveMetaVersion( groupId, artifactId, project.getPluginArtifactRepositories(),
-                                                         localRepository, Artifact.RELEASE_VERSION );
+                    updatedVersion = resolveMetaVersion( groupId, artifactId, project,
+                                                         localRepository, Artifact.LATEST_VERSION );
 
                     if ( StringUtils.isNotEmpty( updatedVersion ) && !updatedVersion.equals( version ) )
                     {
@@ -158,20 +149,12 @@
 
         boolean forcePersist = false;
 
-        // are we using the LATEST metadata to resolve plugin version?
-        Boolean rtCheckLatest = settingsRTInfo.getCheckLatestPluginVersion();
-
-        boolean checkLatestMetadata = Boolean.TRUE.equals( rtCheckLatest ) || (
-            !Boolean.FALSE.equals( rtCheckLatest ) &&
-                Boolean.valueOf( getPluginRegistry( groupId, artifactId ).getCheckLatest() )
-                    .booleanValue() );
-
-        // third pass...if we're checking for latest install/deploy, retrieve the version for LATEST metadata and also
-        // set that resolved version as the <useVersion/> in settings.xml.
-        if ( StringUtils.isEmpty( version ) && checkLatestMetadata )
+        // third pass...we're always checking for latest install/deploy, so retrieve the version for LATEST metadata and
+        // also set that resolved version as the <useVersion/> in settings.xml.
+        if ( StringUtils.isEmpty( version ) )
         {
             // 1. resolve the version to be used
-            version = resolveMetaVersion( groupId, artifactId, project.getPluginArtifactRepositories(), localRepository,
+            version = resolveMetaVersion( groupId, artifactId, project, localRepository,
                                           Artifact.LATEST_VERSION );
 
             if ( version != null )
@@ -185,24 +168,26 @@
             }
         }
 
+        // TODO: Remove this...it shouldn't be needed anymore.
+        
         // final pass...retrieve the version for RELEASE and also set that resolved version as the <useVersion/>
         // in settings.xml.
-        if ( StringUtils.isEmpty( version ) )
-        {
-            // 1. resolve the version to be used
-            version = resolveMetaVersion( groupId, artifactId, project.getPluginArtifactRepositories(), localRepository,
-                                          Artifact.RELEASE_VERSION );
-
-            if ( version != null )
-            {
-                // 2. Set the updatedVersion so the user will be prompted whether to make this version permanent.
-                updatedVersion = version;
-
-                // 3. Persist this version without prompting.
-                forcePersist = true;
-                promptToPersist = false;
-            }
-        }
+//        if ( StringUtils.isEmpty( version ) )
+//        {
+//            // 1. resolve the version to be used
+//            version = resolveMetaVersion( groupId, artifactId, project.getPluginArtifactRepositories(), localRepository,
+//                                          Artifact.RELEASE_VERSION );
+//
+//            if ( version != null )
+//            {
+//                // 2. Set the updatedVersion so the user will be prompted whether to make this version permanent.
+//                updatedVersion = version;
+//
+//                // 3. Persist this version without prompting.
+//                forcePersist = true;
+//                promptToPersist = false;
+//            }
+//        }
 
         // if we still haven't found a version, then fail early before we get into the update goop.
         if ( StringUtils.isEmpty( version ) )
@@ -633,66 +618,75 @@
         return pluginRegistry;
     }
 
-    private String resolveMetaVersion( String groupId, String artifactId, List remoteRepositories,
+    private String resolveMetaVersion( String groupId, String artifactId, MavenProject project,
                                        ArtifactRepository localRepository, String metaVersionId )
         throws PluginVersionResolutionException
     {
         Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, metaVersionId );
 
+        project.replaceWithActiveArtifact( artifact );
+        
         String version = null;
 
-        try
+        if ( artifact.isResolved() )
         {
-            ResolutionGroup resolutionGroup = artifactMetadataSource.retrieve( artifact, localRepository,
-                                                                               remoteRepositories );
-
-            // switching this out with the actual resolved artifact instance, since the MMSource re-creates the pom
-            // artifact.
-            artifact = resolutionGroup.getPomArtifact();
-
-            // make sure this artifact was actually resolved to a file in the repo...
-            if ( artifact.getFile() != null )
+            version = artifact.getVersion();
+        }
+        else
+        {
+            try
             {
-                MavenProject project = mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories,
-                                                                                localRepository, false );
+                ResolutionGroup resolutionGroup = artifactMetadataSource.retrieve( artifact, localRepository,
+                                                                                   project.getPluginArtifactRepositories() );
 
-                boolean pluginValid = true;
+                // switching this out with the actual resolved artifact instance, since the MMSource re-creates the pom
+                // artifact.
+                artifact = resolutionGroup.getPomArtifact();
 
-                // if we don't have the required Maven version, then ignore an update
-                if ( project.getPrerequisites() != null && project.getPrerequisites().getMaven() != null )
+                // make sure this artifact was actually resolved to a file in the repo...
+                if ( artifact.getFile() != null )
                 {
-                    DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(
-                        project.getPrerequisites().getMaven() );
+                    MavenProject pluginProject = mavenProjectBuilder.buildFromRepository( artifact, project
+                        .getPluginArtifactRepositories(), localRepository, false );
+
+                    boolean pluginValid = true;
 
-                    if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) < 0 )
+                    // if we don't have the required Maven version, then ignore an update
+                    if ( pluginProject.getPrerequisites() != null && pluginProject.getPrerequisites().getMaven() != null )
                     {
-                        getLogger().info( "Ignoring available plugin update: " + artifact.getVersion() +
-                            " as it requires Maven version " + requiredVersion );
-                        pluginValid = false;
+                        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;
+                        }
                     }
-                }
 
-                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 );
-        }
-        catch ( IOException e )
-        {
-            throw new PluginVersionResolutionException( groupId, artifactId,
-                                                        "Unable to determine Maven version for comparison", e );
+            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 );
+            }
+            catch ( IOException e )
+            {
+                throw new PluginVersionResolutionException( groupId, artifactId,
+                                                            "Unable to determine Maven version for comparison", e );
+            }
         }
 
         return version;

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java Tue Oct 11 00:35:33 2005
@@ -37,9 +37,12 @@
 
         StringBuffer message = new StringBuffer();
 
-        message.append( "Failed to resolve artifact." );
+        message.append( "Failed to resolve artifact.\n" );
+        message.append( "\nGroupId: " ).append( exception.getGroupId() );
+        message.append( "\nArtifactId: " ).append( exception.getArtifactId() );
+        message.append( "\nVersion: " ).append( exception.getVersion() );
         message.append( "\n\n" );
-        message.append( exception.getMessage() );
+        message.append( "Reason: " ).append( exception.getMessage() );
 
         if ( !wagonManager.isOnline() )
         {

Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java?rev=312827&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java Tue Oct 11 00:35:33 2005
@@ -0,0 +1,54 @@
+package org.apache.maven.usability;
+
+import org.apache.maven.project.InvalidProjectModelException;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.validation.ModelValidationResult;
+
+public class ProjectBuildDiagnoser
+    implements ErrorDiagnoser
+{
+
+    public boolean canDiagnose( Throwable error )
+    {
+        return DiagnosisUtils.containsInCausality( error, ProjectBuildingException.class );
+    }
+
+    public String diagnose( Throwable error )
+    {
+        ProjectBuildingException pbe = (ProjectBuildingException) DiagnosisUtils.getFromCausality( error, ProjectBuildingException.class );
+        
+        StringBuffer message = new StringBuffer();
+        
+        message.append( "Error building POM (may not be this project's POM)." ).append( "\n\n" );
+        
+        message.append( "\nProject ID: " ).append( pbe.getProjectId() );
+        
+        if ( pbe instanceof InvalidProjectModelException )
+        {
+            InvalidProjectModelException ipme = (InvalidProjectModelException) pbe;
+            
+            message.append( "\nPOM Location: " ).append( ipme.getPomLocation() );
+            
+            ModelValidationResult result = ipme.getValidationResult();
+            
+            if ( result != null )
+            {
+                message.append( "\nValidation Messages:\n\n" ).append( ipme.getValidationResult().render( "    " ) );
+            }
+        }
+        
+        message.append( "\n\n" ).append( "Reason: " ).append( pbe.getMessage() );
+        
+        Throwable t = DiagnosisUtils.getRootCause( error );
+        
+        if ( t != null && t != pbe )
+        {
+            message.append( "\n" ).append( "Root Cause: " ).append( t.getMessage() );
+        }
+        
+        message.append( "\n\n" );
+        
+        return message.toString();
+    }
+
+}

Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml Tue Oct 11 00:35:33 2005
@@ -93,6 +93,16 @@
     </component>
     <!--
     |
+    |ProjectBuildDiagnoser
+    |
+    -->
+    <component>
+      <role>org.apache.maven.usability.ErrorDiagnoser</role>
+      <role-hint>ProjectBuildDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.ProjectBuildDiagnoser</implementation>
+    </component>
+    <!--
+    |
     |ProfileActivationDiagnoser
     |
     -->
@@ -307,7 +317,8 @@
               <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
               <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
               <package>
-                org.apache.maven.plugins:maven-jar-plugin:jar
+                org.apache.maven.plugins:maven-jar-plugin:jar,
+                org.apache.maven.plugins:maven-plugin-plugin:addPluginArtifactMetadata
               </package>
               <install>org.apache.maven.plugins:maven-install-plugin:install</install>
               <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>

Modified: maven/components/trunk/maven-mboot2/src/main/java/download/ArtifactDownloader.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-mboot2/src/main/java/download/ArtifactDownloader.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-mboot2/src/main/java/download/ArtifactDownloader.java (original)
+++ maven/components/trunk/maven-mboot2/src/main/java/download/ArtifactDownloader.java Tue Oct 11 00:35:33 2005
@@ -163,9 +163,24 @@
                     File file = localFile;
                     if ( remoteFile.exists() )
                     {
-                        if ( !localFile.exists() || localFile.lastModified() < remoteFile.lastModified() )
+                        if ( !localFile.exists() )
                         {
                             file = remoteFile;
+                        }
+                        else
+                        {
+                            RepositoryMetadata localMetadata = RepositoryMetadata.read( localFile );
+                            
+                            RepositoryMetadata remoteMetadata = RepositoryMetadata.read( remoteFile );
+                            
+                            if ( remoteMetadata.getLastUpdatedUtc() > localMetadata.getLastUpdatedUtc() )
+                            {
+                                file = remoteFile;
+                            }
+                            else
+                            {
+                                file = localFile;
+                            }
                         }
                     }
 

Modified: maven/components/trunk/maven-mboot2/src/main/java/download/RepositoryMetadata.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-mboot2/src/main/java/download/RepositoryMetadata.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-mboot2/src/main/java/download/RepositoryMetadata.java (original)
+++ maven/components/trunk/maven-mboot2/src/main/java/download/RepositoryMetadata.java Tue Oct 11 00:35:33 2005
@@ -26,9 +26,14 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
+import java.util.TimeZone;
 
 /**
  * I/O for repository metadata.
@@ -174,6 +179,21 @@
             baseVersion = StringUtils.replace( baseVersion, "SNAPSHOT", snapshotTimestamp + "-" + snapshotBuildNumber );
         }
         return baseVersion;
+    }
+    
+    public long getLastUpdatedUtc()
+    {
+        TimeZone timezone = TimeZone.getTimeZone( "UTC" );
+        DateFormat fmt = new SimpleDateFormat( "yyyyMMddHHmmss" );
+        
+        try
+        {
+            return fmt.parse( lastUpdated ).getTime();
+        }
+        catch ( ParseException e )
+        {
+            return -1;
+        }
     }
 
     public void setLastUpdated( String lastUpdated )

Modified: maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java Tue Oct 11 00:35:33 2005
@@ -1,6 +1,7 @@
 package org.apache.maven.plugins.projecthelp;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Plugin;
@@ -215,6 +216,11 @@
                 throw new MojoExecutionException( "Error retrieving plugin descriptor for:\n\ngroupId: \'" + groupId
                     + "\'\nartifactId: \'" + artifactId + "\'\nversion: \'" + version + "\'\n\n", e );
             }
+            catch ( ArtifactNotFoundException e )
+            {
+                throw new MojoExecutionException( "Error retrieving plugin descriptor for:\n\ngroupId: \'" + groupId
+                                                  + "\'\nartifactId: \'" + artifactId + "\'\nversion: \'" + version + "\'\n\n", e );
+            }
         }
         
         return descriptor;
@@ -325,6 +331,26 @@
         String eGoal = md.getExecuteGoal();
         String eLife = md.getExecuteLifecycle();
         String ePhase = md.getExecutePhase();
+        
+        if ( eGoal != null || ePhase != null )
+        {
+            buffer.append( "\n\nBefore this mojo executes, it will call:\n" );
+            
+            if ( eGoal != null )
+            {
+                buffer.append( "\nSingle mojo: \'" ).append( eGoal ).append( "\'" );
+            }
+            
+            if ( ePhase != null )
+            {
+                buffer.append( "\nPhase: \'" ).append( ePhase ).append( "\'" );
+                
+                if ( eLife != null )
+                {
+                    buffer.append( " in Lifecycle Overlay: \'" ).append( eLife ).append( "\'" );
+                }
+            }
+        }
         
         List parameters = md.getParameters();
         

Modified: maven/components/trunk/maven-plugins/maven-surefire-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-surefire-plugin/pom.xml?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-surefire-plugin/pom.xml (original)
+++ maven/components/trunk/maven-plugins/maven-surefire-plugin/pom.xml Tue Oct 11 00:35:33 2005
@@ -23,10 +23,6 @@
       <scope>runtime</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-project</artifactId>
-    </dependency>
-    <dependency>
       <groupId>surefire</groupId>
       <artifactId>surefire</artifactId>
       <version>1.4-SNAPSHOT</version>
@@ -54,6 +50,11 @@
       <artifactId>plexus-utils</artifactId>
       <version>1.0.4-SNAPSHOT</version>
       <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0-beta-4-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>

Modified: maven/components/trunk/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java (original)
+++ maven/components/trunk/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java Tue Oct 11 00:35:33 2005
@@ -268,14 +268,14 @@
             surefireBooter.addClassPathUrl( classpathElement );
         }
 
-        for ( Iterator i = pluginArtifacts.iterator(); i.hasNext(); )
-        {
-            Artifact artifact = (Artifact) i.next();
-
-            getLog().debug( artifact.getFile().getAbsolutePath() );
-
-            surefireBooter.addClassPathUrl( artifact.getFile().getAbsolutePath() );
-        }
+//        for ( Iterator i = pluginArtifacts.iterator(); i.hasNext(); )
+//        {
+//            Artifact artifact = (Artifact) i.next();
+//
+//            getLog().debug( artifact.getFile().getAbsolutePath() );
+//
+//            surefireBooter.addClassPathUrl( artifact.getFile().getAbsolutePath() );
+//        }
 
         addReporters(surefireBooter);
         

Modified: maven/components/trunk/maven-plugins/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/pom.xml?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/pom.xml (original)
+++ maven/components/trunk/maven-plugins/pom.xml Tue Oct 11 00:35:33 2005
@@ -175,7 +175,7 @@
     <module>maven-javadoc-plugin</module>
     <module>maven-plugin-plugin</module>
     <module>maven-pmd-plugin</module>
-    <module>maven-projecthelp-plugin</module>
+    <!-- module>maven-projecthelp-plugin</module -->
     <module>maven-project-info-reports-plugin</module>
     <module>maven-rar-plugin</module>
     <module>maven-release-plugin</module>

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Tue Oct 11 00:35:33 2005
@@ -18,6 +18,7 @@
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.ArtifactStatus;
+import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.manager.WagonManager;
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
@@ -183,7 +184,7 @@
         // TODO: such a call in MavenMetadataSource too - packaging not really the intention of type
         Artifact projectArtifact = project.getArtifact();
 
-        Map managedVersions = createManagedVersionMap( project.getDependencyManagement() );
+        Map managedVersions = createManagedVersionMap( project.getId(), project.getDependencyManagement() );
 
         ensureMetadataSourceIsInitialized();
 
@@ -193,7 +194,7 @@
         }
         catch ( InvalidVersionSpecificationException e )
         {
-            throw new ProjectBuildingException( "Error in dependency version", e );
+            throw new ProjectBuildingException( project.getId(), "Error in dependency version", e );
         }
 
         if ( transferListener != null )
@@ -223,12 +224,12 @@
             }
             catch ( ComponentLookupException e )
             {
-                throw new ProjectBuildingException( "Cannot lookup metadata source for building the project.", e );
+                throw new ProjectBuildingException( "all", "Cannot lookup metadata source for building the project.", e );
             }
         }
     }
 
-    private Map createManagedVersionMap( DependencyManagement dependencyManagement )
+    private Map createManagedVersionMap( String projectId, DependencyManagement dependencyManagement )
         throws ProjectBuildingException
     {
         Map map;
@@ -249,7 +250,7 @@
                 }
                 catch ( InvalidVersionSpecificationException e )
                 {
-                    throw new ProjectBuildingException( "Unable to parse dependency version", e );
+                    throw new ProjectBuildingException( projectId, "Unable to parse dependency version", e );
                 }
             }
         }
@@ -271,7 +272,7 @@
                                               ProfileManager profileManager )
         throws ProjectBuildingException
     {
-        Model model = readModel( projectDescriptor );
+        Model model = readModel( "unknown", projectDescriptor );
 
         // Always cache files in the source tree over those in the repository
         MavenProject p = new MavenProject( model );
@@ -284,7 +285,7 @@
 
         if ( project.getDistributionManagement() != null && project.getDistributionManagement().getStatus() != null )
         {
-            throw new ProjectBuildingException(
+            throw new ProjectBuildingException( project.getId(), 
                 "Invalid project file: distribution status must not be specified for a project outside of the repository" );
         }
 
@@ -350,6 +351,8 @@
         Model model;
         if ( project == null )
         {
+            String projectId = ArtifactUtils.versionlessKey( projectArtifact );
+            
             try
             {
                 artifactResolver.resolve( projectArtifact, remoteArtifactRepositories, localRepository );
@@ -358,7 +361,7 @@
                 // TODO: how can this not be true?
                 if ( projectArtifact.isResolved() )
                 {
-                    model = readModel( file );
+                    model = readModel( projectId, file );
 
                     String downloadUrl = null;
                     ArtifactStatus status = ArtifactStatus.NONE;
@@ -421,12 +424,12 @@
                 }
                 else
                 {
-                    throw new ProjectBuildingException( "POM could not be resolved from the repository" );
+                    throw new ProjectBuildingException( projectId, "POM could not be resolved from the repository" );
                 }
             }
             catch ( ArtifactResolutionException e )
             {
-                throw new ProjectBuildingException( "Error getting the POM in the repository", e );
+                throw new ProjectBuildingException( projectId, "Error getting the POM in the repository", e );
             }
             catch ( ArtifactNotFoundException e )
             {
@@ -436,7 +439,7 @@
                 }
                 else
                 {
-                    throw new ProjectBuildingException( "POM not found in repository", e );
+                    throw new ProjectBuildingException( projectId, "POM not found in repository", e );
                 }
             }
         }
@@ -514,6 +517,8 @@
         // Use a TreeSet to ensure ordering is retained
         Set aggregatedRemoteWagonRepositories = new LinkedHashSet();
 
+        String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
+        
         List activeExternalProfiles;
         try
         {
@@ -528,7 +533,7 @@
         }
         catch ( ProfileActivationException e )
         {
-            throw new ProjectBuildingException( "Failed to calculate active external profiles.", e );
+            throw new ProjectBuildingException( projectId, "Failed to calculate active external profiles.", e );
         }
 
         for ( Iterator i = activeExternalProfiles.iterator(); i.hasNext(); )
@@ -586,7 +591,7 @@
         }
         catch ( ModelInterpolationException e )
         {
-            throw new ProjectBuildingException( "Error building project from \'" + pomLocation + "\': " + model.getId(),
+            throw new ProjectBuildingException( project.getId(), "Error building project from \'" + pomLocation + "\': " + model.getId(),
                                                 e );
         }
         projectCache.put( createCacheKey( project.getGroupId(), project.getArtifactId(), project.getVersion() ),
@@ -594,6 +599,25 @@
         return project;
     }
 
+    private String safeVersionlessKey( String groupId, String artifactId )
+    {
+        String gid = groupId;
+        
+        if ( StringUtils.isEmpty( gid ) )
+        {
+            gid = "unknown";
+        }
+        
+        String aid = artifactId;
+        
+        if ( StringUtils.isEmpty( aid ) )
+        {
+            aid = "unknown";
+        }
+        
+        return ArtifactUtils.versionlessKey( gid, aid );
+    }
+
     private List buildArtifactRepositories( Model model )
         throws ProjectBuildingException
     {
@@ -698,17 +722,16 @@
 
         if ( validationResult.getMessageCount() > 0 )
         {
-            throw new ProjectBuildingException( "Failed to validate POM for \'" + pomLocation +
-                "\'.\n\n  Reason(s):\n" + validationResult.render( "  " ) );
+            throw new InvalidProjectModelException( project.getId(), pomLocation, "Failed to validate POM", validationResult );
         }
 
         project.setRemoteArtifactRepositories(
             ProjectUtils.buildArtifactRepositories( model.getRepositories(), artifactRepositoryFactory, container ) );
 
         // TODO: these aren't taking active project artifacts into consideration in the reactor
-        project.setPluginArtifacts( createPluginArtifacts( project.getBuildPlugins() ) );
-        project.setReportArtifacts( createReportArtifacts( project.getReportPlugins() ) );
-        project.setExtensionArtifacts( createExtensionArtifacts( project.getBuildExtensions() ) );
+        project.setPluginArtifacts( createPluginArtifacts( project.getId(), project.getBuildPlugins() ) );
+        project.setReportArtifacts( createReportArtifacts( project.getId(), project.getReportPlugins() ) );
+        project.setExtensionArtifacts( createExtensionArtifacts( project.getId(), project.getBuildExtensions() ) );
 
         return project;
     }
@@ -756,7 +779,9 @@
         }
         catch ( ProfileActivationException e )
         {
-            throw new ProjectBuildingException( "Failed to activate local (project-level) build profiles.", e );
+            String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
+            
+            throw new ProjectBuildingException( projectId, "Failed to activate local (project-level) build profiles.", e );
         }
 
         MavenProject project = new MavenProject( model );
@@ -769,17 +794,19 @@
 
         if ( parentModel != null )
         {
+            String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
+            
             if ( StringUtils.isEmpty( parentModel.getGroupId() ) )
             {
-                throw new ProjectBuildingException( "Missing groupId element from parent element" );
+                throw new ProjectBuildingException( projectId, "Missing groupId element from parent element" );
             }
             else if ( StringUtils.isEmpty( parentModel.getArtifactId() ) )
             {
-                throw new ProjectBuildingException( "Missing artifactId element from parent element" );
+                throw new ProjectBuildingException( projectId, "Missing artifactId element from parent element" );
             }
             else if ( StringUtils.isEmpty( parentModel.getVersion() ) )
             {
-                throw new ProjectBuildingException( "Missing version element from parent element" );
+                throw new ProjectBuildingException( projectId, "Missing version element from parent element" );
             }
 
             // the only way this will have a value is if we find the parent on disk...
@@ -818,7 +845,7 @@
 
                 if ( parentDescriptor != null && parentDescriptor.exists() )
                 {
-                    Model candidateParent = readModel( parentDescriptor );
+                    Model candidateParent = readModel( projectId, parentDescriptor );
 
                     String candidateParentGroupId = candidateParent.getGroupId();
                     if ( candidateParentGroupId == null && candidateParent.getParent() != null )
@@ -908,7 +935,9 @@
             }
             catch ( ProfileActivationException e )
             {
-                throw new ProjectBuildingException( "Failed to calculate active build profiles.", e );
+                String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
+                
+                throw new ProjectBuildingException( projectId, "Failed to calculate active build profiles.", e );
             }
 
             for ( Iterator it = activeProfiles.iterator(); it.hasNext(); )
@@ -967,27 +996,27 @@
         }
     }
 
-    private Model readModel( File file )
+    private Model readModel( String projectId, File file )
         throws ProjectBuildingException
     {
         Reader reader = null;
         try
         {
             reader = new FileReader( file );
-            return readModel( reader );
+            return readModel( projectId, file.getAbsolutePath(), reader );
         }
         catch ( FileNotFoundException e )
         {
-            throw new ProjectBuildingException( "Could not find the model file '" + file.getAbsolutePath() + "'.", e );
+            throw new ProjectBuildingException( projectId, "Could not find the model file '" + file.getAbsolutePath() + "'.", e );
         }
         catch ( IOException e )
         {
-            throw new ProjectBuildingException( "Failed to build model from file '" + file.getAbsolutePath() +
+            throw new ProjectBuildingException( projectId, "Failed to build model from file '" + file.getAbsolutePath() +
                 "'.\nError: \'" + e.getLocalizedMessage() + "\'", e );
         }
         catch ( XmlPullParserException e )
         {
-            throw new ProjectBuildingException( "Failed to parse model from file '" + file.getAbsolutePath() +
+            throw new ProjectBuildingException( projectId, "Failed to parse model from file '" + file.getAbsolutePath() +
                 "'.\nError: \'" + e.getLocalizedMessage() + "\'", e );
         }
         finally
@@ -996,8 +1025,8 @@
         }
     }
 
-    private Model readModel( Reader reader )
-        throws IOException, XmlPullParserException, InvalidModelException
+    private Model readModel( String projectId, String pomLocation, Reader reader )
+        throws IOException, XmlPullParserException, InvalidProjectModelException
     {
         StringWriter sw = new StringWriter();
 
@@ -1007,7 +1036,7 @@
 
         if ( modelSource.indexOf( "<modelVersion>4.0.0" ) < 0 )
         {
-            throw new InvalidModelException( "Invalid POM (not v4.0.0 modelVersion)" );
+            throw new InvalidProjectModelException( projectId, pomLocation, "Invalid POM (not v4.0.0 modelVersion)" );
         }
 
         StringReader sReader = new StringReader( modelSource );
@@ -1015,23 +1044,23 @@
         return modelReader.read( sReader );
     }
 
-    private Model readModel( URL url )
+    private Model readModel( String projectId, URL url )
         throws ProjectBuildingException
     {
         InputStreamReader reader = null;
         try
         {
             reader = new InputStreamReader( url.openStream() );
-            return readModel( reader );
+            return readModel( projectId, url.toExternalForm(), reader );
         }
         catch ( IOException e )
         {
-            throw new ProjectBuildingException( "Failed build model from URL \'" + url.toExternalForm() +
+            throw new ProjectBuildingException( projectId, "Failed build model from URL \'" + url.toExternalForm() +
                 "\'\nError: \'" + e.getLocalizedMessage() + "\'", e );
         }
         catch ( XmlPullParserException e )
         {
-            throw new ProjectBuildingException( "Failed to parse model from URL \'" + url.toExternalForm() +
+            throw new ProjectBuildingException( projectId, "Failed to parse model from URL \'" + url.toExternalForm() +
                 "\'\nError: \'" + e.getLocalizedMessage() + "\'", e );
         }
         finally
@@ -1050,7 +1079,7 @@
         return groupId + ":" + artifactId + ":" + version;
     }
 
-    protected Set createPluginArtifacts( List plugins )
+    protected Set createPluginArtifacts( String projectId, List plugins )
         throws ProjectBuildingException
     {
         Set pluginArtifacts = new HashSet();
@@ -1077,7 +1106,7 @@
             }
             catch ( InvalidVersionSpecificationException e )
             {
-                throw new ProjectBuildingException( "Unable to parse plugin version", e );
+                throw new ProjectBuildingException( projectId, "Unable to parse plugin version", e );
             }
 
             if ( artifact != null )
@@ -1090,7 +1119,7 @@
     }
 
     // TODO: share with createPluginArtifacts?
-    protected Set createReportArtifacts( List reports )
+    protected Set createReportArtifacts( String projectId, List reports )
         throws ProjectBuildingException
     {
         Set pluginArtifacts = new HashSet();
@@ -1119,7 +1148,7 @@
                 }
                 catch ( InvalidVersionSpecificationException e )
                 {
-                    throw new ProjectBuildingException( "Unable to parse plugin version", e );
+                    throw new ProjectBuildingException( projectId, "Unable to parse plugin version", e );
                 }
 
                 if ( artifact != null )
@@ -1133,7 +1162,7 @@
     }
 
     // TODO: share with createPluginArtifacts?
-    protected Set createExtensionArtifacts( List extensions )
+    protected Set createExtensionArtifacts( String projectId, List extensions )
         throws ProjectBuildingException
     {
         Set extensionArtifacts = new HashSet();
@@ -1162,7 +1191,7 @@
                 }
                 catch ( InvalidVersionSpecificationException e )
                 {
-                    throw new ProjectBuildingException( "Unable to parse extension version", e );
+                    throw new ProjectBuildingException( projectId, "Unable to parse extension version", e );
                 }
 
                 if ( artifact != null )
@@ -1215,7 +1244,9 @@
         }
         catch ( ModelInterpolationException e )
         {
-            throw new ProjectBuildingException( "Error building super-project", e );
+            String projectId = safeVersionlessKey( STANDALONE_SUPERPOM_GROUPID, STANDALONE_SUPERPOM_ARTIFACTID );
+            
+            throw new ProjectBuildingException( projectId, "Error building super-project", e );
         }
     }
 
@@ -1228,7 +1259,9 @@
     {
         URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + MAVEN_MODEL_VERSION + ".xml" );
 
-        return readModel( url );
+        String projectId = safeVersionlessKey( STANDALONE_SUPERPOM_GROUPID, STANDALONE_SUPERPOM_ARTIFACTID );
+        
+        return readModel( projectId, url );
     }
 
     public void contextualize( Context context )

Added: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java?rev=312827&view=auto
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java (added)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java Tue Oct 11 00:35:33 2005
@@ -0,0 +1,37 @@
+package org.apache.maven.project;
+
+import org.apache.maven.project.validation.ModelValidationResult;
+
+public class InvalidProjectModelException
+    extends ProjectBuildingException
+{
+
+    private final String pomLocation;
+    private ModelValidationResult validationResult;
+
+    public InvalidProjectModelException( String projectId, String pomLocation, String message, ModelValidationResult validationResult )
+    {
+        super( projectId, message );
+        
+        this.pomLocation = pomLocation;
+        this.validationResult = validationResult;
+    }
+
+    public InvalidProjectModelException( String projectId, String pomLocation, String message )
+    {
+        super( projectId, message );
+        
+        this.pomLocation = pomLocation;
+    }
+
+    public final String getPomLocation()
+    {
+        return pomLocation;
+    }
+
+    public final ModelValidationResult getValidationResult()
+    {
+        return validationResult;
+    }
+
+}

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java Tue Oct 11 00:35:33 2005
@@ -23,18 +23,22 @@
 public class ProjectBuildingException
     extends Exception
 {
-    public ProjectBuildingException( String message )
+    private final String projectId;
+
+    public ProjectBuildingException( String projectId, String message )
     {
         super( message );
+        this.projectId = projectId;
     }
 
-    public ProjectBuildingException( Throwable cause )
+    public ProjectBuildingException( String projectId, String message, Throwable cause )
     {
-        super( cause );
+        super( message, cause );
+        this.projectId = projectId;
     }
-
-    public ProjectBuildingException( String message, Throwable cause )
+    
+    public String getProjectId()
     {
-        super( message, cause );
+        return projectId;
     }
 }

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java Tue Oct 11 00:35:33 2005
@@ -139,7 +139,7 @@
         }
         catch ( ComponentLookupException e )
         {
-            throw new ProjectBuildingException( "Cannot find layout implementation corresponding to: \'" + layout +
+            throw new ProjectBuildingException( "all", "Cannot find layout implementation corresponding to: \'" + layout +
                 "\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e );
         }
         return repositoryLayout;

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java Tue Oct 11 00:35:33 2005
@@ -104,8 +104,6 @@
     public void setFile( File destination )
     {
         artifact.setFile( destination );
-
-        // TODO: [jc; 29-jul-05] Is this appropriate? I mean, isn't the point to use the project-file instead??
         project.getArtifact().setFile( destination );
     }
 

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=312827&r1=312826&r2=312827&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 Tue Oct 11 00:35:33 2005
@@ -37,7 +37,7 @@
 import org.apache.maven.model.DistributionManagement;
 import org.apache.maven.model.Exclusion;
 import org.apache.maven.model.Relocation;
-import org.apache.maven.project.InvalidModelException;
+import org.apache.maven.project.InvalidProjectModelException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
@@ -107,10 +107,10 @@
                     project = mavenProjectBuilder.buildFromRepository( pomArtifact, remoteRepositories, localRepository,
                                                                        true );
                 }
-                catch ( InvalidModelException e )
+                catch ( InvalidProjectModelException e )
                 {
                     getLogger().warn( "POM for: \'" + pomArtifact +
-                        "\' does not appear to be valid. Its will be ignored for artifact resolution." );
+                        "\' does not appear to be valid. Its will be ignored for artifact resolution.\n\nReason: " + e.getMessage() + "\n\n" );
 
                     project = null;
                 }

Modified: maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java?rev=312827&r1=312826&r2=312827&view=diff
==============================================================================
--- maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java (original)
+++ maven/components/trunk/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java Tue Oct 11 00:35:33 2005
@@ -34,7 +34,7 @@
     private boolean pluginRegistryActive = true;
     
     // using Boolean for 3VL (null for not-set, otherwise override with value)
-    private Boolean checkLatest;
+//    private Boolean checkLatest;
     
     private Map activeProfileToSourceLevel = new HashMap();
     
@@ -127,14 +127,4 @@
         return localRepositorySourceLevel;
     }
     
-    public void setCheckLatestPluginVersion( Boolean checkLatest )
-    {
-        this.checkLatest = checkLatest;
-    }
-    
-    public Boolean getCheckLatestPluginVersion()
-    {
-        return checkLatest;
-    }
-
 }