o Fixed missing basedir alignment

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@753361 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-03-13 19:25:02 +00:00
parent 35c1ff3f4c
commit fbc5bf92d0
2 changed files with 35 additions and 15 deletions

View File

@ -26,6 +26,7 @@ import java.util.List;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.Reporting;
import org.apache.maven.model.Resource;
import org.codehaus.plexus.component.annotations.Component;
@ -77,6 +78,13 @@ public class DefaultPathTranslator
build.setTestOutputDirectory( alignToBaseDirectory( build.getTestOutputDirectory(), basedir ) );
}
Reporting reporting = model.getReporting();
if ( reporting != null )
{
reporting.setOutputDirectory( alignToBaseDirectory( reporting.getOutputDirectory(), basedir ) );
}
}
public String alignToBaseDirectory( String path, File basedir )
@ -204,6 +212,13 @@ public class DefaultPathTranslator
build.setTestOutputDirectory( unalignFromBaseDirectory( build.getTestOutputDirectory(), basedir ) );
}
Reporting reporting = model.getReporting();
if ( reporting != null )
{
reporting.setOutputDirectory( unalignFromBaseDirectory( reporting.getOutputDirectory(), basedir ) );
}
}
public String unalignFromBaseDirectory( String directory, File basedir )

View File

@ -422,21 +422,36 @@ public class MavenProject
// Test and compile sourceroots.
// ----------------------------------------------------------------------
public void addCompileSourceRoot( String path )
private void addPath( List<String> paths, String path )
{
if ( path != null )
{
path = path.trim();
if ( path.length() != 0 )
if ( path.length() > 0 )
{
if ( !getCompileSourceRoots().contains( path ) )
File file = new File( path );
if ( file.isAbsolute() )
{
getCompileSourceRoots().add( path );
path = file.getAbsolutePath();
}
else
{
path = new File( getBasedir(), path ).getAbsolutePath();
}
if ( !paths.contains( path ) )
{
paths.add( path );
}
}
}
}
public void addCompileSourceRoot( String path )
{
addPath( getCompileSourceRoots(), path );
}
public void addScriptSourceRoot( String path )
{
if ( path != null )
@ -454,17 +469,7 @@ public class MavenProject
public void addTestCompileSourceRoot( String path )
{
if ( path != null )
{
path = path.trim();
if ( path.length() != 0 )
{
if ( !getTestCompileSourceRoots().contains( path ) )
{
getTestCompileSourceRoots().add( path );
}
}
}
addPath( getTestCompileSourceRoots(), path );
}
public List<String> getCompileSourceRoots()