o Improved robustness

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@895291 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-01-02 21:13:54 +00:00
parent a5b2dd1a1f
commit 9f217fd24c
2 changed files with 23 additions and 2 deletions

View File

@ -465,7 +465,15 @@ public class DefaultMaven
Collection<MavenProject> activeProjects = sorter.getSortedProjects(); Collection<MavenProject> activeProjects = sorter.getSortedProjects();
File reactorDirectory = request.getPom().getAbsoluteFile().getParentFile(); File reactorDirectory;
if ( request.getBaseDirectory() != null )
{
reactorDirectory = new File( request.getBaseDirectory() );
}
else
{
reactorDirectory = null;
}
if ( !request.getSelectedProjects().isEmpty() ) if ( !request.getSelectedProjects().isEmpty() )
{ {
@ -596,7 +604,7 @@ public class DefaultMaven
} }
// relative path, e.g. "sub", "../sub" or "." // relative path, e.g. "sub", "../sub" or "."
else else if ( reactorDirectory != null )
{ {
File selectedProject = new File( new File( reactorDirectory, selector ).toURI().normalize() ); File selectedProject = new File( new File( reactorDirectory, selector ).toURI().normalize() );

View File

@ -240,9 +240,22 @@ public class DefaultMavenExecutionRequestPopulator
} }
} }
private void baseDirectory( MavenExecutionRequest request )
{
if ( request.getBaseDirectory() == null )
{
if ( request.getPom() != null )
{
request.setBaseDirectory( request.getPom().getAbsoluteFile().getParentFile() );
}
}
}
public MavenExecutionRequest populateDefaults( MavenExecutionRequest request ) public MavenExecutionRequest populateDefaults( MavenExecutionRequest request )
throws MavenExecutionRequestPopulationException throws MavenExecutionRequestPopulationException
{ {
baseDirectory( request );
localRepository( request ); localRepository( request );
populateDefaultPluginGroups( request ); populateDefaultPluginGroups( request );