decoupled project #file and #basedir to allow pom.xml processing

Signed-off-by: Igor Fedorenko <ifedorenko@apache.org>
This commit is contained in:
Igor Fedorenko 2014-11-25 15:32:49 -05:00
parent 8643e00993
commit c15226f13f
1 changed files with 14 additions and 9 deletions

View File

@ -101,6 +101,8 @@ public class MavenProject
private File file;
private File basedir;
private Set<Artifact> resolvedArtifacts;
private ArtifactFilter artifactFilter;
@ -251,21 +253,24 @@ public class MavenProject
}
public void setFile( File file )
{
this.file = file;
this.basedir = file != null ? file.getParentFile() : null;
}
/**
* Sets project {@code file} without changing project {@code basedir}.
*
* @since 3.2.4
*/
public void setPomFile( File file )
{
this.file = file;
}
public File getBasedir()
{
if ( getFile() != null )
{
return getFile().getParentFile();
}
else
{
// repository based POM
return null;
}
return basedir;
}
public void setDependencies( List<Dependency> dependencies )