diff --git a/maven-core-it/it0045/cli-options.txt b/maven-core-it/it0045/cli-options.txt
index c70ad73fb2..45f5015472 100644
--- a/maven-core-it/it0045/cli-options.txt
+++ b/maven-core-it/it0045/cli-options.txt
@@ -1 +1 @@
---no-plugin-registry --check-plugin-latest
+--no-plugin-registry
diff --git a/maven-core-it/it0046/cli-options.txt b/maven-core-it/it0046/cli-options.txt
index 03f69cc1b7..6cb8c2462d 100644
--- a/maven-core-it/it0046/cli-options.txt
+++ b/maven-core-it/it0046/cli-options.txt
@@ -1 +1 @@
---no-plugin-registry --check-plugin-latest --fail-never
+--no-plugin-registry --fail-never
diff --git a/maven-core-it/it0051/cli-options.txt b/maven-core-it/it0051/cli-options.txt
index 22bb982654..9e54c78050 100644
--- a/maven-core-it/it0051/cli-options.txt
+++ b/maven-core-it/it0051/cli-options.txt
@@ -1 +1 @@
---check-plugin-latest --no-plugin-registry -DperformRelease=true
+--no-plugin-registry -DperformRelease=true
diff --git a/maven-core-it/it0052/cli-options.txt b/maven-core-it/it0052/cli-options.txt
index 1aa671e31f..45f5015472 100644
--- a/maven-core-it/it0052/cli-options.txt
+++ b/maven-core-it/it0052/cli-options.txt
@@ -1 +1 @@
---check-plugin-latest --no-plugin-registry
+--no-plugin-registry
diff --git a/maven-core-it/it0053/cli-options.txt b/maven-core-it/it0053/cli-options.txt
index 1aa671e31f..45f5015472 100644
--- a/maven-core-it/it0053/cli-options.txt
+++ b/maven-core-it/it0053/cli-options.txt
@@ -1 +1 @@
---check-plugin-latest --no-plugin-registry
+--no-plugin-registry
diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
index 0d7f50601d..16cb462b80 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -448,7 +448,7 @@ public class DefaultMaven
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 @@ public class DefaultMaven
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." );
}
}
diff --git a/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
index 11fe5dce23..c3bc0e491d 100644
--- a/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -350,15 +350,6 @@ public class MavenCli
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 class MavenCli
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 @@ public class MavenCli
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 @@ public class MavenCli
"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 ) );
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
index 1367ca1e00..7489d00977 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
@@ -106,6 +106,8 @@ public class DefaultLifecycleExecutor
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();
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
index adf3c2fe7c..c12b6f2b91 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
@@ -171,51 +171,73 @@ public class DefaultPluginManager
// 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() );
+
+ 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 );
+
+ artifactResolver.resolve( pluginArtifact, project.getPluginArtifactRepositories(), localRepository );
+
+ if ( !pluginArtifact.isResolved() )
{
- VersionRange versionRange = VersionRange.createFromVersionSpec( plugin.getVersion() );
+ throw new PluginContainerException( plugin, "Cannot resolve artifact for plugin." );
+ }
- 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 );
+ PlexusContainer pluginContainer = container.getChildContainer( plugin.getKey() );
+
+ File pluginFile = pluginArtifact.getFile();
+
+ if ( !pluginCollector.isPluginInstalled( plugin ) || pluginContainer == null )
+ {
addPlugin( plugin, pluginArtifact, project, localRepository );
-
- project.addPlugin( plugin );
}
- catch ( ArtifactNotFoundException e )
+ else if ( pluginFile.lastModified() > pluginContainer.getCreationDate().getTime() )
{
- 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 );
- }
- else
- {
- throw e;
- }
+ getLogger().info( "Reloading plugin container for: " + plugin.getKey() + ". The plugin artifact has changed." );
+
+ pluginContainer.dispose();
+
+ addPlugin( plugin, pluginArtifact, project, localRepository );
}
- catch ( InvalidVersionSpecificationException 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 PluginVersionResolutionException( plugin.getGroupId(), plugin.getArtifactId(),
- "Invalid version specification", e );
+ 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;
}
}
-
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new PluginVersionResolutionException( plugin.getGroupId(), plugin.getArtifactId(),
+ "Invalid version specification", e );
+ }
+
return pluginCollector.getPluginDescriptor( plugin );
}
@@ -259,15 +281,6 @@ public class DefaultPluginManager
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 @@ public class DefaultPluginManager
}
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 @@ public class DefaultPluginManager
{
throw new PluginManagerException( "Cannot find PlexusContainer for plugin: " + pluginKey );
}
+
return pluginContainer;
}
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java b/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
index bf9174176e..dcfc0a7521 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
@@ -50,7 +50,6 @@ import java.text.SimpleDateFormat;
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 @@ public class DefaultPluginVersionManager
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 @@ public class DefaultPluginVersionManager
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 @@ public class DefaultPluginVersionManager
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 @@ public class DefaultPluginVersionManager
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 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 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 @@ public class DefaultPluginVersionManager
}
}
+ // TODO: Remove this...it shouldn't be needed anymore.
+
// final pass...retrieve the version for RELEASE and also set that resolved version as the
// 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 @@ public class DefaultPluginVersionManager
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 );
- if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) < 0 )
+ boolean pluginValid = true;
+
+ // 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();
+
+ if ( pluginValid && !metaVersionId.equals( artifactVersion ) )
+ {
+ version = artifactVersion;
}
}
-
- String artifactVersion = artifact.getVersion();
-
- 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;
diff --git a/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
index be1db94961..0080163d89 100644
--- a/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
+++ b/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
@@ -37,9 +37,12 @@ public class ArtifactNotFoundDiagnoser
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() )
{
diff --git a/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
new file mode 100644
index 0000000000..33b499d500
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
@@ -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();
+ }
+
+}
diff --git a/maven-core/src/main/resources/META-INF/plexus/components.xml b/maven-core/src/main/resources/META-INF/plexus/components.xml
index 3bb1652591..2e1339e030 100644
--- a/maven-core/src/main/resources/META-INF/plexus/components.xml
+++ b/maven-core/src/main/resources/META-INF/plexus/components.xml
@@ -93,6 +93,16 @@
+
+ org.apache.maven.usability.ErrorDiagnoser
+ ProjectBuildDiagnoser
+ org.apache.maven.usability.ProjectBuildDiagnoser
+
+
@@ -307,7 +317,8 @@
org.apache.maven.plugins:maven-compiler-plugin:testCompile
org.apache.maven.plugins:maven-surefire-plugin:test
- org.apache.maven.plugins:maven-jar-plugin:jar
+ org.apache.maven.plugins:maven-jar-plugin:jar,
+ org.apache.maven.plugins:maven-plugin-plugin:addPluginArtifactMetadata
org.apache.maven.plugins:maven-install-plugin:install
org.apache.maven.plugins:maven-deploy-plugin:deploy
diff --git a/maven-mboot2/src/main/java/download/ArtifactDownloader.java b/maven-mboot2/src/main/java/download/ArtifactDownloader.java
index 2c8f8d72eb..d349ca2d01 100644
--- a/maven-mboot2/src/main/java/download/ArtifactDownloader.java
+++ b/maven-mboot2/src/main/java/download/ArtifactDownloader.java
@@ -163,10 +163,25 @@ public class ArtifactDownloader
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;
+ }
+ }
}
if ( file.exists() )
diff --git a/maven-mboot2/src/main/java/download/RepositoryMetadata.java b/maven-mboot2/src/main/java/download/RepositoryMetadata.java
index edecbb227a..243dbff00b 100644
--- a/maven-mboot2/src/main/java/download/RepositoryMetadata.java
+++ b/maven-mboot2/src/main/java/download/RepositoryMetadata.java
@@ -26,9 +26,14 @@ import java.io.File;
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.
@@ -175,6 +180,21 @@ public class RepositoryMetadata
}
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 )
{
diff --git a/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java b/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
index bbed2176de..303181b3ce 100644
--- a/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
+++ b/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
@@ -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 @@ public class DescribeMojo
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;
@@ -326,6 +332,26 @@ public class DescribeMojo
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();
List requirements = md.getRequirements();
diff --git a/maven-plugins/maven-surefire-plugin/pom.xml b/maven-plugins/maven-surefire-plugin/pom.xml
index 78fbdc01f0..fb80e2f356 100644
--- a/maven-plugins/maven-surefire-plugin/pom.xml
+++ b/maven-plugins/maven-surefire-plugin/pom.xml
@@ -22,10 +22,6 @@
3.8.1
runtime
-
- org.apache.maven
- maven-project
-
surefire
surefire
@@ -55,5 +51,10 @@
1.0.4-SNAPSHOT
runtime
+
+ org.apache.maven
+ maven-artifact
+ 2.0-beta-4-SNAPSHOT
+
diff --git a/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java b/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java
index 7a37e1f681..03f0d2ffc5 100644
--- a/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java
+++ b/maven-plugins/maven-surefire-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java
@@ -268,14 +268,14 @@ public class SurefirePlugin
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);
diff --git a/maven-plugins/pom.xml b/maven-plugins/pom.xml
index 491b4ec8f0..1c41a60ac4 100644
--- a/maven-plugins/pom.xml
+++ b/maven-plugins/pom.xml
@@ -175,7 +175,7 @@
maven-javadoc-plugin
maven-plugin-plugin
maven-pmd-plugin
- maven-projecthelp-plugin
+
maven-project-info-reports-plugin
maven-rar-plugin
maven-release-plugin
diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
index 4878d6f727..ae7d4b5307 100644
--- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
+++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
@@ -18,6 +18,7 @@ package org.apache.maven.project;
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 @@ public class DefaultMavenProjectBuilder
// 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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
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 @@ public class DefaultMavenProjectBuilder
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 @@ public class DefaultMavenProjectBuilder
Model model;
if ( project == null )
{
+ String projectId = ArtifactUtils.versionlessKey( projectArtifact );
+
try
{
artifactResolver.resolve( projectArtifact, remoteArtifactRepositories, localRepository );
@@ -358,7 +361,7 @@ public class DefaultMavenProjectBuilder
// 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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
}
else
{
- throw new ProjectBuildingException( "POM not found in repository", e );
+ throw new ProjectBuildingException( projectId, "POM not found in repository", e );
}
}
}
@@ -514,6 +517,8 @@ public class DefaultMavenProjectBuilder
// 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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
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 @@ public class DefaultMavenProjectBuilder
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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
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 @@ public class DefaultMavenProjectBuilder
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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
}
}
- 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 @@ public class DefaultMavenProjectBuilder
}
}
- 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 @@ public class DefaultMavenProjectBuilder
if ( modelSource.indexOf( "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 @@ public class DefaultMavenProjectBuilder
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 @@ public class DefaultMavenProjectBuilder
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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
}
// 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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
}
// 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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
}
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 @@ public class DefaultMavenProjectBuilder
{
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 )
diff --git a/maven-project/src/main/java/org/apache/maven/project/InvalidModelException.java b/maven-project/src/main/java/org/apache/maven/project/InvalidModelException.java
deleted file mode 100644
index fbbe3daec7..0000000000
--- a/maven-project/src/main/java/org/apache/maven/project/InvalidModelException.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.apache.maven.project;
-
-public class InvalidModelException
- extends ProjectBuildingException
-{
-
- public InvalidModelException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public InvalidModelException( String message )
- {
- super( message );
- }
-
-}
diff --git a/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java b/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java
new file mode 100644
index 0000000000..4667e27682
--- /dev/null
+++ b/maven-project/src/main/java/org/apache/maven/project/InvalidProjectModelException.java
@@ -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;
+ }
+
+}
diff --git a/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java b/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java
index 5363b27786..357cf70424 100644
--- a/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java
+++ b/maven-project/src/main/java/org/apache/maven/project/ProjectBuildingException.java
@@ -23,18 +23,22 @@ package org.apache.maven.project;
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 )
- {
- super( cause );
- }
-
- public ProjectBuildingException( String message, Throwable cause )
+ public ProjectBuildingException( String projectId, String message, Throwable cause )
{
super( message, cause );
+ this.projectId = projectId;
+ }
+
+ public String getProjectId()
+ {
+ return projectId;
}
}
diff --git a/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java b/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java
index 3f51def211..b43ea71c76 100644
--- a/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java
+++ b/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java
@@ -139,7 +139,7 @@ public final class ProjectUtils
}
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;
diff --git a/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java b/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
index 9a8557b2e6..eb0f70cf1f 100644
--- a/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
+++ b/maven-project/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
@@ -104,8 +104,6 @@ public class ActiveProjectArtifact
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 );
}
diff --git a/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java b/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
index 5c7038d1a6..3c8c430184 100644
--- a/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
+++ b/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
@@ -37,7 +37,7 @@ import org.apache.maven.model.Dependency;
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 @@ public class MavenMetadataSource
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;
}
diff --git a/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java b/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java
index f438630225..2c758d7b1b 100644
--- a/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java
+++ b/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java
@@ -34,7 +34,7 @@ public class RuntimeInfo
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 @@ public class RuntimeInfo
return localRepositorySourceLevel;
}
- public void setCheckLatestPluginVersion( Boolean checkLatest )
- {
- this.checkLatest = checkLatest;
- }
-
- public Boolean getCheckLatestPluginVersion()
- {
- return checkLatest;
- }
-
}