Fixing standalone maven-core build...fixing metadata merge where lastUpdated == "null" (null-string)...and finally, disabling plugin resolution from referencing the current project, since this will really screw up builds of plugins that are referenced in the plugin lifecycle mapping...like maven-surefire-plugin.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@312948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-10-11 20:01:43 +00:00
parent 637a4df7f3
commit 32841e4e03
2 changed files with 70 additions and 59 deletions

View File

@ -93,23 +93,33 @@ public class DefaultPluginVersionManager
// first pass...if the plugin is specified in the pom, try to retrieve the version from there.
String version = getVersionFromPluginConfig( groupId, artifactId, project, resolveAsReportPlugin );
// NOTE: [jc; 11-Oct-2005] We CANNOT have this type of code in here. It will prevent plugins from building themselves,
// if they are part of the lifecycle mapping. For example, try the following:
//
// 1. Uncomment the remainder of the following code block and rebuild the core jar; put it in the m2 distro
// 2. rm -Rf <local-repo>/org/apache/maven/plugins/maven-surefire-plugin
// 3. go to <maven>/maven-plugins/maven-surefire-plugin, and try to build it.
//
// In the above example, the surefire plugin fails to build because the version used for testing is
// resolved to the version currently being built...which obviously doesn't exist yet.
// if there was no explicit version, try for one in the reactor
if ( version == null )
{
// check self
if ( project.getGroupId().equals( groupId ) && project.getArtifactId().equals( artifactId ) )
{
version = project.getVersion();
}
else if ( project.getProjectReferences() != null )
{
// if ( project.getGroupId().equals( groupId ) && project.getArtifactId().equals( artifactId ) )
// {
// version = project.getVersion();
// }
// else if ( project.getProjectReferences() != null )
// {
String refId = ArtifactUtils.versionlessKey( groupId, artifactId );
MavenProject ref = (MavenProject) project.getProjectReferences().get( refId );
if ( ref != null )
{
version = ref.getVersion();
}
}
// }
}
// we're NEVER going to persist POM-derived plugin versions.
@ -640,16 +650,8 @@ public class DefaultPluginVersionManager
{
Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, metaVersionId );
project.replaceWithActiveArtifact( artifact );
String version = null;
if ( artifact.isResolved() )
{
version = artifact.getVersion();
}
else
{
try
{
ResolutionGroup resolutionGroup = artifactMetadataSource.retrieve( artifact, localRepository,
@ -704,7 +706,6 @@ public class DefaultPluginVersionManager
throw new PluginVersionResolutionException( groupId, artifactId,
"Unable to determine Maven version for comparison", e );
}
}
return version;
}

View File

@ -109,6 +109,16 @@
}
}
if ( "null".equals( versioning.getLastUpdated() ) )
{
versioning.setLastUpdated( null );
}
if ( "null".equals( v.getLastUpdated() ) )
{
v.setLastUpdated( null );
}
if ( versioning.getLastUpdated() == null || versioning.getLastUpdated().length() == 0 )
{
// this should only be for historical reasons - we assume local is newer