mirror of https://github.com/apache/maven.git
[MNG-6533] catch InvalidArtifactRTException runtime exception
instead of global Exception that may hide too many cases
This commit is contained in:
parent
27332cfab0
commit
24c762d7c3
|
@ -33,6 +33,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.InvalidArtifactRTException;
|
||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.LegacyLocalRepositoryManager;
|
||||
|
@ -464,10 +465,10 @@ public class DefaultProjectBuilder
|
|||
// first pass: build without building parent.
|
||||
initProject( project, projectIndex, false, result, new HashMap<File, Boolean>( 0 ), config.request );
|
||||
}
|
||||
catch ( Exception e )
|
||||
catch ( InvalidArtifactRTException iarte )
|
||||
{
|
||||
result.getProblems().add( new DefaultModelProblem( null, ModelProblem.Severity.ERROR, null, model, -1, -1,
|
||||
e ) );
|
||||
iarte ) );
|
||||
}
|
||||
|
||||
projectIndex.put( result.getModelIds().get( 0 ), project );
|
||||
|
@ -619,10 +620,10 @@ public class DefaultProjectBuilder
|
|||
{
|
||||
initProject( project, projectIndex, true, result, profilesXmls, request );
|
||||
}
|
||||
catch ( Exception e )
|
||||
catch ( InvalidArtifactRTException iarte )
|
||||
{
|
||||
result.getProblems().add( new DefaultModelProblem( null, ModelProblem.Severity.ERROR, null,
|
||||
result.getEffectiveModel(), -1, -1, e ) );
|
||||
result.getEffectiveModel(), -1, -1, iarte ) );
|
||||
}
|
||||
|
||||
List<MavenProject> modules = new ArrayList<>();
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.List;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.AbstractCoreMavenComponentTestCase;
|
||||
import org.apache.maven.artifact.InvalidArtifactRTException;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.model.building.FileModelSource;
|
||||
import org.apache.maven.model.building.ModelBuildingRequest;
|
||||
|
@ -220,6 +221,16 @@ public class ProjectBuilderTest
|
|||
org.apache.maven.project.ProjectBuilder projectBuilder =
|
||||
lookup( org.apache.maven.project.ProjectBuilder.class );
|
||||
|
||||
// single project build entry point
|
||||
try
|
||||
{
|
||||
projectBuilder.build( pomFile, configuration );
|
||||
}
|
||||
catch ( InvalidArtifactRTException iarte )
|
||||
{
|
||||
assertTrue( iarte.getMessage().contains( "The groupId cannot be empty." ) );
|
||||
}
|
||||
|
||||
// multi projects build entry point
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue