Nested buildfiles with Nant.

  • Thread starter Thread starter Nigel Currie
  • Start date Start date
N

Nigel Currie

Hi all,

I'm having a problem with <nant> tasks to build sub-projects into an
overall solution. I have the following directory structure:

JobManagerSolution
|_
| JobManager
|_
JobManagerController

where the overall build file is in JobManagerSolution and the
sub-project build files are in JobManager and JobManagerControl. This
is the JobmanagerSolution build file:

<?xml version="1.0"?>
<project name="JobManager" default="build" basedir=".">
<target name="build" description="Clean and build entire solution.">
<nant buildfile="JobManager/JobManager.build" target="clean"
failonerror="false" />
<nant buildfile="JobManager/JobManager.build" />
<nant buildfile="JobManagerControl/JobManagerControl.build"
target="clean" failonerror="false" />
<nant buildfile="JobManagerControl/JobManagerControl.build" />
</target>
</project>

The problem I'm having is that the basedir of the parent build is
being inherited by JobManager and JobManagerControl, and so the paths
are all wrong. I know ant has a dir attribute which can be used to
determine which basedir the child build will have, but there seems to
be no equivalent in Nant. Also I've tried explicitly setting
inheritall="false", but the parent project directory is still used by
the children.

Anyone else come across this?
 
The problem I'm having is that the basedir of the parent build is
being inherited by JobManager and JobManagerControl, and so the paths
are all wrong. I know ant has a dir attribute which can be used to
determine which basedir the child build will have, but there seems to
be no equivalent in Nant. Also I've tried explicitly setting
inheritall="false", but the parent project directory is still used by
the children.

Have you tried using ${nant.project.basedir} ?

It appears to be relative to the project build file and will be
correct in your child builds.

HTH,

Jonathan Cogley
 
Back
Top