o remove the resolve plugin version, this logic will all be handled by building up the project model, and there will be no magical plugin version diddling. you must set the version of the plugins you're using.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@774327 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-05-13 13:15:48 +00:00
parent dba032a96f
commit 267ec868f2
1 changed files with 4 additions and 65 deletions

View File

@ -170,11 +170,12 @@ public class DefaultPluginManager
protected PluginDescriptor addPlugin( Plugin plugin, MavenProject project, ArtifactRepository localRepository )
throws ArtifactNotFoundException, ArtifactResolutionException, PluginVersionResolutionException, PluginContainerException, PluginVersionNotFoundException
{
resolvePluginVersion( plugin, project );
Artifact pluginArtifact = repositorySystem.createPluginArtifact( plugin );
ArtifactResolutionRequest request = new ArtifactResolutionRequest( pluginArtifact, localRepository, project.getRemoteArtifactRepositories() );
ArtifactResolutionRequest request = new ArtifactResolutionRequest()
.setArtifact( pluginArtifact )
.setLocalRepository( localRepository )
.setRemoteRepostories( project.getRemoteArtifactRepositories() );
ArtifactResolutionResult result = repositorySystem.resolve( request );
@ -535,68 +536,6 @@ public class DefaultPluginManager
}
}
public void resolvePluginVersion( Plugin plugin, MavenProject project )
throws PluginVersionNotFoundException
{
String version = plugin.getVersion();
if ( version != null && !Artifact.RELEASE_VERSION.equals( version ) )
{
return;
}
String groupId = plugin.getGroupId();
String artifactId = plugin.getArtifactId();
if ( project.getBuildPlugins() != null )
{
for ( Plugin p : project.getBuildPlugins() )
{
if ( groupId.equals( p.getGroupId() ) && artifactId.equals( p.getArtifactId() ) )
{
version = p.getVersion();
}
}
}
if ( StringUtils.isEmpty( version ) || Artifact.RELEASE_VERSION.equals( version ) )
{
// 1. resolve the version to be used
Artifact artifact = repositorySystem.createProjectArtifact( groupId, artifactId, Artifact.RELEASE_VERSION );
String artifactVersion = artifact.getVersion();
// make sure this artifact was transformed to a real version, and actually resolved to a file in the repo...
if ( !Artifact.RELEASE_VERSION.equals( artifactVersion ) && ( artifact.getFile() != null ) )
{
boolean pluginValid = false;
while ( !pluginValid && ( artifactVersion != null ) )
{
pluginValid = true;
artifact = repositorySystem.createProjectArtifact( groupId, artifactId, artifactVersion );
}
version = artifactVersion;
}
if ( version == null )
{
version = artifactVersion;
}
}
// if we still haven't found a version, then fail early before we get into the update goop.
if ( StringUtils.isEmpty( version ) )
{
throw new PluginVersionNotFoundException( groupId, artifactId );
}
plugin.setVersion( version );
}
public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, MavenProject project, ArtifactRepository localRepository )
throws PluginLoaderException
{