mirror of https://github.com/apache/maven.git
PR: MNG-122
cleanup artifact/plugin not found exception git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@320704 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
562facf5d2
commit
1f97932050
|
@ -102,11 +102,11 @@ public class DefaultArchetype
|
||||||
}
|
}
|
||||||
catch ( ArtifactResolutionException e )
|
catch ( ArtifactResolutionException e )
|
||||||
{
|
{
|
||||||
throw new ArchetypeDescriptorException( "Cannot download archetype.", e );
|
throw new ArchetypeDescriptorException( "Error attempting to download archetype: " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
catch ( ArtifactNotFoundException e )
|
catch ( ArtifactNotFoundException e )
|
||||||
{
|
{
|
||||||
throw new ArchetypeNotFoundException( "Cannot download archetype.", e );
|
throw new ArchetypeNotFoundException( "Archetype does not exist: " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
|
@ -166,12 +166,11 @@ public class DependenciesTask
|
||||||
}
|
}
|
||||||
catch ( ArtifactResolutionException e )
|
catch ( ArtifactResolutionException e )
|
||||||
{
|
{
|
||||||
throw new BuildException( "Unable to resolve artifact", e );
|
throw new BuildException( "Unable to resolve artifact: " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
catch ( ArtifactNotFoundException e )
|
catch ( ArtifactNotFoundException e )
|
||||||
{
|
{
|
||||||
// TODO: improve handling
|
throw new BuildException( "Dependency not found: " + e.getMessage(), e );
|
||||||
throw new BuildException( "Unable to locate artifact", e );
|
|
||||||
}
|
}
|
||||||
catch ( InvalidDependencyVersionException e )
|
catch ( InvalidDependencyVersionException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,11 +103,12 @@ public class InstallWagonProviderTask
|
||||||
}
|
}
|
||||||
catch ( ArtifactResolutionException e )
|
catch ( ArtifactResolutionException e )
|
||||||
{
|
{
|
||||||
throw new BuildException( "Unable to locate wagon provider in remote repository", e );
|
throw new BuildException( "Error downloading wagon provider from the remote repository: " + e.getMessage(),
|
||||||
|
e );
|
||||||
}
|
}
|
||||||
catch ( ArtifactNotFoundException e )
|
catch ( ArtifactNotFoundException e )
|
||||||
{
|
{
|
||||||
throw new BuildException( "Unable to locate wagon provider in remote repository", e );
|
throw new BuildException( "Unable to locate wagon provider in remote repository: " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
|
||||||
log( "Installing provider: " + providerArtifact );
|
log( "Installing provider: " + providerArtifact );
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.apache.maven.plugin.MojoFailureException;
|
||||||
import org.apache.maven.plugin.PluginConfigurationException;
|
import org.apache.maven.plugin.PluginConfigurationException;
|
||||||
import org.apache.maven.plugin.PluginManager;
|
import org.apache.maven.plugin.PluginManager;
|
||||||
import org.apache.maven.plugin.PluginManagerException;
|
import org.apache.maven.plugin.PluginManagerException;
|
||||||
|
import org.apache.maven.plugin.PluginNotFoundException;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
import org.apache.maven.plugin.lifecycle.Execution;
|
import org.apache.maven.plugin.lifecycle.Execution;
|
||||||
|
@ -168,6 +169,10 @@ public class DefaultLifecycleExecutor
|
||||||
{
|
{
|
||||||
response.setException( e );
|
response.setException( e );
|
||||||
}
|
}
|
||||||
|
catch ( PluginNotFoundException e )
|
||||||
|
{
|
||||||
|
response.setException( e );
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
response.setFinish( new Date() );
|
response.setFinish( new Date() );
|
||||||
|
@ -177,7 +182,8 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
|
|
||||||
private void findExtensions( MavenSession session )
|
private void findExtensions( MavenSession session )
|
||||||
throws ArtifactNotFoundException, ArtifactResolutionException, LifecycleExecutionException
|
throws ArtifactNotFoundException, ArtifactResolutionException, LifecycleExecutionException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
for ( Iterator i = session.getSortedProjects().iterator(); i.hasNext(); )
|
for ( Iterator i = session.getSortedProjects().iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
|
@ -205,7 +211,7 @@ public class DefaultLifecycleExecutor
|
||||||
MavenProject rootProject, EventDispatcher dispatcher,
|
MavenProject rootProject, EventDispatcher dispatcher,
|
||||||
MavenExecutionResponse response )
|
MavenExecutionResponse response )
|
||||||
throws ArtifactNotFoundException, MojoExecutionException, LifecycleExecutionException, MojoFailureException,
|
throws ArtifactNotFoundException, MojoExecutionException, LifecycleExecutionException, MojoFailureException,
|
||||||
ArtifactResolutionException
|
ArtifactResolutionException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
for ( Iterator it = taskSegments.iterator(); it.hasNext(); )
|
for ( Iterator it = taskSegments.iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
|
@ -341,7 +347,7 @@ public class DefaultLifecycleExecutor
|
||||||
MavenExecutionResponse response, EventDispatcher dispatcher,
|
MavenExecutionResponse response, EventDispatcher dispatcher,
|
||||||
String event, ReactorManager rm, long buildStartTime, String target )
|
String event, ReactorManager rm, long buildStartTime, String target )
|
||||||
throws LifecycleExecutionException, MojoExecutionException, MojoFailureException, ArtifactNotFoundException,
|
throws LifecycleExecutionException, MojoExecutionException, MojoFailureException, ArtifactNotFoundException,
|
||||||
ArtifactResolutionException
|
ArtifactResolutionException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -423,7 +429,8 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
|
|
||||||
private List segmentTaskListByAggregationNeeds( List tasks, MavenSession session, MavenProject project )
|
private List segmentTaskListByAggregationNeeds( List tasks, MavenSession session, MavenProject project )
|
||||||
throws LifecycleExecutionException
|
throws LifecycleExecutionException, ArtifactNotFoundException, PluginNotFoundException,
|
||||||
|
ArtifactResolutionException
|
||||||
{
|
{
|
||||||
List segments = new ArrayList();
|
List segments = new ArrayList();
|
||||||
|
|
||||||
|
@ -453,25 +460,9 @@ public class DefaultLifecycleExecutor
|
||||||
currentSegment.add( task );
|
currentSegment.add( task );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
MojoDescriptor mojo = null;
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// definitely a CLI goal, can use prefix
|
// definitely a CLI goal, can use prefix
|
||||||
mojo = getMojoDescriptor( task, session, project, task, true );
|
MojoDescriptor mojo = getMojoDescriptor( task, session, project, task, true );
|
||||||
}
|
|
||||||
catch ( ArtifactResolutionException e )
|
|
||||||
{
|
|
||||||
getLogger().info(
|
|
||||||
"Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
|
|
||||||
getLogger().debug( "", e );
|
|
||||||
}
|
|
||||||
catch ( ArtifactNotFoundException e )
|
|
||||||
{
|
|
||||||
getLogger().info(
|
|
||||||
"Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
|
|
||||||
getLogger().debug( "", e );
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the mojo descriptor was found, determine aggregator status according to:
|
// if the mojo descriptor was found, determine aggregator status according to:
|
||||||
// 1. whether the mojo declares itself an aggregator
|
// 1. whether the mojo declares itself an aggregator
|
||||||
|
@ -526,7 +517,7 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private void executeGoal( String task, MavenSession session, MavenProject project, MavenExecutionResponse response )
|
private void executeGoal( String task, MavenSession session, MavenProject project, MavenExecutionResponse response )
|
||||||
throws LifecycleExecutionException, ArtifactNotFoundException, MojoExecutionException,
|
throws LifecycleExecutionException, ArtifactNotFoundException, MojoExecutionException,
|
||||||
ArtifactResolutionException, MojoFailureException, InvalidDependencyVersionException
|
ArtifactResolutionException, MojoFailureException, InvalidDependencyVersionException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
if ( getPhaseToLifecycleMap().containsKey( task ) )
|
if ( getPhaseToLifecycleMap().containsKey( task ) )
|
||||||
{
|
{
|
||||||
|
@ -545,7 +536,7 @@ public class DefaultLifecycleExecutor
|
||||||
private void executeGoalWithLifecycle( String task, MavenSession session, Map lifecycleMappings,
|
private void executeGoalWithLifecycle( String task, MavenSession session, Map lifecycleMappings,
|
||||||
MavenProject project, MavenExecutionResponse response, Lifecycle lifecycle )
|
MavenProject project, MavenExecutionResponse response, Lifecycle lifecycle )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException, MojoFailureException,
|
throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException, MojoFailureException,
|
||||||
ArtifactNotFoundException, InvalidDependencyVersionException
|
ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
List goals = processGoalChain( task, lifecycleMappings, lifecycle );
|
List goals = processGoalChain( task, lifecycleMappings, lifecycle );
|
||||||
|
|
||||||
|
@ -562,7 +553,7 @@ public class DefaultLifecycleExecutor
|
||||||
private void executeStandaloneGoal( String task, MavenSession session, MavenProject project,
|
private void executeStandaloneGoal( String task, MavenSession session, MavenProject project,
|
||||||
MavenExecutionResponse response )
|
MavenExecutionResponse response )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException, MojoFailureException,
|
throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException, MojoFailureException,
|
||||||
ArtifactNotFoundException, InvalidDependencyVersionException
|
ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
// guaranteed to come from the CLI and not be part of a phase
|
// guaranteed to come from the CLI and not be part of a phase
|
||||||
MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session, project, task, true );
|
MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session, project, task, true );
|
||||||
|
@ -571,7 +562,7 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private void executeGoals( List goals, MavenSession session, MavenProject project, MavenExecutionResponse response )
|
private void executeGoals( List goals, MavenSession session, MavenProject project, MavenExecutionResponse response )
|
||||||
throws LifecycleExecutionException, MojoExecutionException, ArtifactResolutionException, MojoFailureException,
|
throws LifecycleExecutionException, MojoExecutionException, ArtifactResolutionException, MojoFailureException,
|
||||||
ArtifactNotFoundException, InvalidDependencyVersionException
|
ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
for ( Iterator i = goals.iterator(); i.hasNext(); )
|
for ( Iterator i = goals.iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
|
@ -615,7 +606,8 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
|
|
||||||
private List getReports( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
private List getReports( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
List reportPlugins = project.getReportPlugins();
|
List reportPlugins = project.getReportPlugins();
|
||||||
|
|
||||||
|
@ -701,7 +693,8 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session,
|
private List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session,
|
||||||
MojoExecution mojoExecution )
|
MojoExecution mojoExecution )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException, LifecycleExecutionException
|
throws ArtifactResolutionException, ArtifactNotFoundException, LifecycleExecutionException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
PluginDescriptor pluginDescriptor = verifyReportPlugin( reportPlugin, project, session );
|
PluginDescriptor pluginDescriptor = verifyReportPlugin( reportPlugin, project, session );
|
||||||
|
|
||||||
|
@ -751,7 +744,7 @@ public class DefaultLifecycleExecutor
|
||||||
private void forkLifecycle( MojoDescriptor mojoDescriptor, MavenSession session, MavenProject project,
|
private void forkLifecycle( MojoDescriptor mojoDescriptor, MavenSession session, MavenProject project,
|
||||||
MavenExecutionResponse response )
|
MavenExecutionResponse response )
|
||||||
throws LifecycleExecutionException, MojoExecutionException, ArtifactResolutionException, MojoFailureException,
|
throws LifecycleExecutionException, MojoExecutionException, ArtifactResolutionException, MojoFailureException,
|
||||||
ArtifactNotFoundException, InvalidDependencyVersionException
|
ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
|
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
|
||||||
getLogger().info( "Preparing " + pluginDescriptor.getGoalPrefix() + ":" + mojoDescriptor.getGoal() );
|
getLogger().info( "Preparing " + pluginDescriptor.getGoalPrefix() + ":" + mojoDescriptor.getGoal() );
|
||||||
|
@ -782,7 +775,7 @@ public class DefaultLifecycleExecutor
|
||||||
private void forkProjectLifecycle( MojoDescriptor mojoDescriptor, MavenSession session, MavenProject project,
|
private void forkProjectLifecycle( MojoDescriptor mojoDescriptor, MavenSession session, MavenProject project,
|
||||||
MavenExecutionResponse response )
|
MavenExecutionResponse response )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException, MojoFailureException,
|
throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException, MojoFailureException,
|
||||||
ArtifactNotFoundException, InvalidDependencyVersionException
|
ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
|
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
|
||||||
|
|
||||||
|
@ -918,7 +911,8 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private Map constructLifecycleMappings( MavenSession session, String selectedPhase, MavenProject project,
|
private Map constructLifecycleMappings( MavenSession session, String selectedPhase, MavenProject project,
|
||||||
Lifecycle lifecycle )
|
Lifecycle lifecycle )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
// first, bind those associated with the packaging
|
// first, bind those associated with the packaging
|
||||||
Map lifecycleMappings = bindLifecycleForPackaging( session, selectedPhase, project, lifecycle );
|
Map lifecycleMappings = bindLifecycleForPackaging( session, selectedPhase, project, lifecycle );
|
||||||
|
@ -936,7 +930,8 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private Map bindLifecycleForPackaging( MavenSession session, String selectedPhase, MavenProject project,
|
private Map bindLifecycleForPackaging( MavenSession session, String selectedPhase, MavenProject project,
|
||||||
Lifecycle lifecycle )
|
Lifecycle lifecycle )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
Map mappings = findMappingsForLifecycle( session, project, lifecycle );
|
Map mappings = findMappingsForLifecycle( session, project, lifecycle );
|
||||||
|
|
||||||
|
@ -979,7 +974,8 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map findMappingsForLifecycle( MavenSession session, MavenProject project, Lifecycle lifecycle )
|
private Map findMappingsForLifecycle( MavenSession session, MavenProject project, Lifecycle lifecycle )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
String packaging = project.getPackaging();
|
String packaging = project.getPackaging();
|
||||||
Map mappings = null;
|
Map mappings = null;
|
||||||
|
@ -1028,7 +1024,8 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private Object findExtension( MavenProject project, String role, String roleHint, Settings settings,
|
private Object findExtension( MavenProject project, String role, String roleHint, Settings settings,
|
||||||
ArtifactRepository localRepository )
|
ArtifactRepository localRepository )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException, LifecycleExecutionException
|
throws ArtifactResolutionException, ArtifactNotFoundException, LifecycleExecutionException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
Object pluginComponent = null;
|
Object pluginComponent = null;
|
||||||
|
|
||||||
|
@ -1064,7 +1061,8 @@ public class DefaultLifecycleExecutor
|
||||||
* lookup directly, or have them passed in
|
* lookup directly, or have them passed in
|
||||||
*/
|
*/
|
||||||
private Map findArtifactTypeHandlers( MavenProject project, Settings settings, ArtifactRepository localRepository )
|
private Map findArtifactTypeHandlers( MavenProject project, Settings settings, ArtifactRepository localRepository )
|
||||||
throws ArtifactResolutionException, ArtifactNotFoundException, LifecycleExecutionException
|
throws ArtifactResolutionException, ArtifactNotFoundException, LifecycleExecutionException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
Map map = new HashMap();
|
Map map = new HashMap();
|
||||||
for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
|
for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
|
||||||
|
@ -1114,7 +1112,8 @@ public class DefaultLifecycleExecutor
|
||||||
* @param session
|
* @param session
|
||||||
*/
|
*/
|
||||||
private void bindPluginToLifecycle( Plugin plugin, MavenSession session, Map phaseMap, MavenProject project )
|
private void bindPluginToLifecycle( Plugin plugin, MavenSession session, Map phaseMap, MavenProject project )
|
||||||
throws LifecycleExecutionException, ArtifactResolutionException, ArtifactNotFoundException
|
throws LifecycleExecutionException, ArtifactResolutionException, ArtifactNotFoundException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
PluginDescriptor pluginDescriptor;
|
PluginDescriptor pluginDescriptor;
|
||||||
Settings settings = session.getSettings();
|
Settings settings = session.getSettings();
|
||||||
|
@ -1149,7 +1148,8 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
|
private PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
|
||||||
ArtifactRepository localRepository )
|
ArtifactRepository localRepository )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
PluginDescriptor pluginDescriptor;
|
PluginDescriptor pluginDescriptor;
|
||||||
try
|
try
|
||||||
|
@ -1177,7 +1177,8 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
|
|
||||||
private PluginDescriptor verifyReportPlugin( ReportPlugin plugin, MavenProject project, MavenSession session )
|
private PluginDescriptor verifyReportPlugin( ReportPlugin plugin, MavenProject project, MavenSession session )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException
|
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
|
||||||
|
PluginNotFoundException
|
||||||
{
|
{
|
||||||
PluginDescriptor pluginDescriptor;
|
PluginDescriptor pluginDescriptor;
|
||||||
try
|
try
|
||||||
|
@ -1291,7 +1292,8 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project,
|
private MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project,
|
||||||
String invokedVia, boolean canUsePrefix )
|
String invokedVia, boolean canUsePrefix )
|
||||||
throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException
|
throws LifecycleExecutionException, ArtifactNotFoundException, PluginNotFoundException,
|
||||||
|
ArtifactResolutionException
|
||||||
{
|
{
|
||||||
String goal;
|
String goal;
|
||||||
Plugin plugin;
|
Plugin plugin;
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class DefaultPluginManager
|
||||||
public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
|
public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
|
||||||
ArtifactRepository localRepository )
|
ArtifactRepository localRepository )
|
||||||
throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
|
throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
|
||||||
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException
|
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
// TODO: this should be possibly outside
|
// TODO: this should be possibly outside
|
||||||
// All version-resolution logic has been moved to DefaultPluginVersionManager.
|
// All version-resolution logic has been moved to DefaultPluginVersionManager.
|
||||||
|
@ -164,7 +164,7 @@ public class DefaultPluginManager
|
||||||
private PluginDescriptor verifyVersionedPlugin( Plugin plugin, MavenProject project,
|
private PluginDescriptor verifyVersionedPlugin( Plugin plugin, MavenProject project,
|
||||||
ArtifactRepository localRepository )
|
ArtifactRepository localRepository )
|
||||||
throws PluginVersionResolutionException, ArtifactNotFoundException, ArtifactResolutionException,
|
throws PluginVersionResolutionException, ArtifactNotFoundException, ArtifactResolutionException,
|
||||||
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException
|
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
// TODO: this might result in an artifact "RELEASE" being resolved continuously
|
// TODO: this might result in an artifact "RELEASE" being resolved continuously
|
||||||
// FIXME: need to find out how a plugin gets marked as 'installed'
|
// FIXME: need to find out how a plugin gets marked as 'installed'
|
||||||
|
@ -457,7 +457,7 @@ public class DefaultPluginManager
|
||||||
|
|
||||||
public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
|
public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
|
||||||
throws PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException,
|
throws PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException,
|
||||||
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException
|
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException
|
||||||
{
|
{
|
||||||
String version = reportPlugin.getVersion();
|
String version = reportPlugin.getVersion();
|
||||||
|
|
||||||
|
|
|
@ -56,11 +56,11 @@ public interface PluginManager
|
||||||
PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
|
PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
|
||||||
ArtifactRepository localRepository )
|
ArtifactRepository localRepository )
|
||||||
throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
|
throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
|
||||||
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException;
|
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException;
|
||||||
|
|
||||||
PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
|
PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
|
||||||
throws PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException,
|
throws PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException,
|
||||||
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException;
|
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException;
|
||||||
|
|
||||||
Object getPluginComponent( Plugin plugin, String role, String roleHint )
|
Object getPluginComponent( Plugin plugin, String role, String roleHint )
|
||||||
throws PluginManagerException, ComponentLookupException;
|
throws PluginManagerException, ComponentLookupException;
|
||||||
|
|
|
@ -16,6 +16,7 @@ package org.apache.maven.plugin;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,11 +26,11 @@ import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class PluginNotFoundException
|
public class PluginNotFoundException
|
||||||
extends ArtifactNotFoundException
|
extends AbstractArtifactResolutionException
|
||||||
{
|
{
|
||||||
public PluginNotFoundException( ArtifactNotFoundException e )
|
public PluginNotFoundException( ArtifactNotFoundException e )
|
||||||
{
|
{
|
||||||
super( "Plugin could not be found - check that the goal name is correct", e.getGroupId(), e.getArtifactId(),
|
super( "Plugin could not be found - check that the goal name is correct: " + e.getMessage(), e.getGroupId(),
|
||||||
e.getVersion(), "maven-plugin", e.getRemoteRepositories(), e.getDownloadUrl(), e.getCause() );
|
e.getArtifactId(), e.getVersion(), "maven-plugin", e.getRemoteRepositories(), null, e.getCause() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugin.MojoFailureException;
|
import org.apache.maven.plugin.MojoFailureException;
|
||||||
import org.apache.maven.plugin.PluginManager;
|
import org.apache.maven.plugin.PluginManager;
|
||||||
import org.apache.maven.plugin.PluginManagerException;
|
import org.apache.maven.plugin.PluginManagerException;
|
||||||
|
import org.apache.maven.plugin.PluginNotFoundException;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.Parameter;
|
import org.apache.maven.plugin.descriptor.Parameter;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
|
@ -321,8 +322,7 @@ public class DescribeMojo
|
||||||
}
|
}
|
||||||
catch ( ArtifactNotFoundException e )
|
catch ( ArtifactNotFoundException e )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "Error retrieving plugin descriptor for:\n\ngroupId: \'" + groupId +
|
throw new MojoExecutionException( "Plugin dependency does not exist: " + e.getMessage(), e );
|
||||||
"\'\nartifactId: \'" + artifactId + "\'\nversion: \'" + version + "\'\n\n", e );
|
|
||||||
}
|
}
|
||||||
catch ( InvalidVersionSpecificationException e )
|
catch ( InvalidVersionSpecificationException e )
|
||||||
{
|
{
|
||||||
|
@ -334,6 +334,10 @@ public class DescribeMojo
|
||||||
throw new MojoExecutionException( "Error retrieving plugin descriptor for:\n\ngroupId: \'" + groupId +
|
throw new MojoExecutionException( "Error retrieving plugin descriptor for:\n\ngroupId: \'" + groupId +
|
||||||
"\'\nartifactId: \'" + artifactId + "\'\nversion: \'" + version + "\'\n\n", e );
|
"\'\nartifactId: \'" + artifactId + "\'\nversion: \'" + version + "\'\n\n", e );
|
||||||
}
|
}
|
||||||
|
catch ( PluginNotFoundException e )
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException( "Plugin does not exist: " + e.getMessage(), e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return descriptor;
|
return descriptor;
|
||||||
|
|
|
@ -380,9 +380,6 @@ public class DefaultMavenProjectBuilder
|
||||||
artifactResolver.resolve( projectArtifact, remoteArtifactRepositories, localRepository );
|
artifactResolver.resolve( projectArtifact, remoteArtifactRepositories, localRepository );
|
||||||
|
|
||||||
File file = projectArtifact.getFile();
|
File file = projectArtifact.getFile();
|
||||||
// TODO: how can this not be true?
|
|
||||||
if ( projectArtifact.isResolved() )
|
|
||||||
{
|
|
||||||
model = readModel( projectId, file );
|
model = readModel( projectId, file );
|
||||||
|
|
||||||
String downloadUrl = null;
|
String downloadUrl = null;
|
||||||
|
@ -396,6 +393,48 @@ public class DefaultMavenProjectBuilder
|
||||||
status = ArtifactStatus.valueOf( distributionManagement.getStatus() );
|
status = ArtifactStatus.valueOf( distributionManagement.getStatus() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkStatusAndUpdate( projectArtifact, status, file, remoteArtifactRepositories, localRepository );
|
||||||
|
|
||||||
|
// TODO: this is gross. Would like to give it the whole model, but maven-artifact shouldn't depend on that
|
||||||
|
// Can a maven-core implementation of the Artifact interface store it, and be used in the exceptions?
|
||||||
|
if ( downloadUrl != null )
|
||||||
|
{
|
||||||
|
projectArtifact.setDownloadUrl( downloadUrl );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
projectArtifact.setDownloadUrl( model.getUrl() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( ArtifactResolutionException e )
|
||||||
|
{
|
||||||
|
throw new ProjectBuildingException( projectId, "Error getting the POM in the repository", e );
|
||||||
|
}
|
||||||
|
catch ( ArtifactNotFoundException e )
|
||||||
|
{
|
||||||
|
if ( allowStubModel )
|
||||||
|
{
|
||||||
|
getLogger().debug( "Artifact not found - using stub model: " + e.getMessage() );
|
||||||
|
model = createStubModel( projectArtifact );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ProjectBuildingException( projectId, "POM not found in repository", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model = project.getModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkStatusAndUpdate( Artifact projectArtifact, ArtifactStatus status, File file,
|
||||||
|
List remoteArtifactRepositories, ArtifactRepository localRepository )
|
||||||
|
throws ArtifactNotFoundException
|
||||||
|
{
|
||||||
// TODO: configurable actions dependant on status
|
// TODO: configurable actions dependant on status
|
||||||
if ( !projectArtifact.isSnapshot() && status.compareTo( ArtifactStatus.DEPLOYED ) < 0 )
|
if ( !projectArtifact.isSnapshot() && status.compareTo( ArtifactStatus.DEPLOYED ) < 0 )
|
||||||
{
|
{
|
||||||
|
@ -406,13 +445,12 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
if ( policy.checkOutOfDate( new Date( file.lastModified() ) ) )
|
if ( policy.checkOutOfDate( new Date( file.lastModified() ) ) )
|
||||||
{
|
{
|
||||||
getLogger().info( projectArtifact.getArtifactId() +
|
getLogger().info(
|
||||||
": updating metadata due to status of '" + status + "'" );
|
projectArtifact.getArtifactId() + ": updating metadata due to status of '" + status + "'" );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
projectArtifact.setResolved( false );
|
projectArtifact.setResolved( false );
|
||||||
artifactResolver.resolveAlways( projectArtifact, remoteArtifactRepositories,
|
artifactResolver.resolveAlways( projectArtifact, remoteArtifactRepositories, localRepository );
|
||||||
localRepository );
|
|
||||||
}
|
}
|
||||||
catch ( ArtifactResolutionException e )
|
catch ( ArtifactResolutionException e )
|
||||||
{
|
{
|
||||||
|
@ -428,49 +466,6 @@ public class DefaultMavenProjectBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this is gross. Would like to give it the whole model, but maven-artifact shouldn't depend on that
|
|
||||||
// Can a maven-core implementation of the Artifact interface store it, and be used in the exceptions?
|
|
||||||
if ( downloadUrl != null )
|
|
||||||
{
|
|
||||||
projectArtifact.setDownloadUrl( downloadUrl );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
projectArtifact.setDownloadUrl( model.getUrl() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( allowStubModel )
|
|
||||||
{
|
|
||||||
model = createStubModel( projectArtifact );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new ProjectBuildingException( projectId, "POM could not be resolved from the repository" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch ( ArtifactResolutionException e )
|
|
||||||
{
|
|
||||||
throw new ProjectBuildingException( projectId, "Error getting the POM in the repository", e );
|
|
||||||
}
|
|
||||||
catch ( ArtifactNotFoundException e )
|
|
||||||
{
|
|
||||||
if ( allowStubModel )
|
|
||||||
{
|
|
||||||
model = createStubModel( projectArtifact );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new ProjectBuildingException( projectId, "POM not found in repository", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
model = project.getModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
return model;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model createStubModel( Artifact projectArtifact )
|
private Model createStubModel( Artifact projectArtifact )
|
||||||
|
|
Loading…
Reference in New Issue