Hi Carlos, Thanks for responding. I was under the impression that the dir value in the ant element would set the basedir property in the build file being executed. Thus, in the Foo build file, I was hoping that ${basedir}/src would point to Foo's src directory rather than Bar's...
-- Bryan On Thu, May 22, 2008 at 2:02 AM, Carlos Alonso <[EMAIL PROTECTED]> wrote: > Well Bryan, I think that the problem here relies on the <antcall> target, > you are invoking a target that belongs to other ant file, but the basedir > and further properties belongs to the Bar ant file.To avoid this problem, > follow the next example: > > Substitute both your <ant> and <antcall> tasks with something like this: > <ant > antfile="path/to/build.xml" > dir="basedir for the execution" > target="target to be executed" > inheritall="whether you want your invoked build to inherit all > the declared properties at this point or not" > > > <!-- Here you can give the invoked target properties as > arguments --> > <property name="name" value="value" /> > <property name="runtime" value="${env.name}"/> > <property name="nameenvironment" value="${env.name}"/> > </ant> > > Search the ant manual for further information or more detailed information > about this task. > > Regards. > Carlos > > Bryan Richardson escribió: > > Hello all, >> >> I'm having trouble calling one build file from another. I'm using >> Eclipse, >> and I have two projects: >> >> Foo >> Bar >> >> Each project has a build.xml file, and the Bar project depends on a jar >> file >> generated by the Foo project. The following is the build.xml file for >> project Foo: >> >> <project name="Foo" basedir="."> >> <description>Build file for Foo project.</description> >> >> <property name="src.dir" location="${basedir}/src" /> >> <property name="build.dir" location="${basedir}/build" /> >> <property name="class.dir" location="${basedir}/build/classes" /> >> <property name="dist.dir" location="${basedir}/dist" /> >> <property name="dist.src.dir" location="${basedir}/dist/src" /> >> <property name="lib.dir" location="${basedir}/lib" /> >> >> <path id="dependency.path"> >> <fileset dir="${lib.dir}" includes="**/*.jar" /> >> </path> >> >> <target name="init" depends="clean"> >> <mkdir dir="${class.dir}" /> >> <mkdir dir="${dist.src.dir}" /> >> </target> >> >> <target name="clean"> >> <delete dir="${build.dir}" /> >> <delete dir="${dist.dir}" /> >> </target> >> >> <target name="compile" depends="init"> >> <javac destdir="${class.dir}" classpathref="dependency.path" >> debug="on"> >> <src path="${src.dir}" /> >> </javac> >> </target> >> >> <target name="archive" depends="compile"> >> <jar destfile="${dist.dir}/foo.jar" basedir="${class.dir}" /> >> </target> >> </project> >> >> The following is the build.xml file for project Bar: >> >> <project name="Bar" basedir="."> >> <description>Build file for Bar project.</description> >> >> <property name="src.dir" location="${basedir}/src" /> >> <property name="build.dir" location="${basedir}/build" /> >> <property name="class.dir" location="${basedir}/build/classes" /> >> <property name="dist.dir" location="${basedir}/dist" /> >> <property name="dist.src.dir" location="${basedir}/dist/src" /> >> <property name="lib.dir" location="${basedir}/lib" /> >> >> <path id="dependency.path"> >> <fileset dir="${lib.dir}" includes="**/*.jar" /> >> </path> >> >> <target name="init" depends="clean"> >> <mkdir dir="${class.dir}" /> >> <mkdir dir="${dist.src.dir}" /> >> </target> >> >> <target name="clean"> >> <delete dir="${build.dir}" /> >> <delete dir="${dist.dir}" /> >> </target> >> >> <target name="archive-all"> >> <ant dir="../Foo" target="archive" /> >> >> <antcall target="archive" /> >> </target> >> >> <target name="compile" depends="init"> >> <copy file="../Foo/dist/foo.jar" todir="lib" /> >> <javac destdir="${class.dir}" classpathref="dependency.path" >> debug="on"> >> <src path="${src.dir}" /> >> </javac> >> </target> >> >> <target name="archive" depends="compile"> >> <jar destfile="${dist.dir}/bar.jar" basedir="${class.dir}" > >> <manifest> >> <attribute name="Class-Path" value="lib/foo.jar" /> >> </manifest> >> </jar> >> </target> >> </project> >> >> The problem occurs when the Bar project's build.xml calls the Foo >> project's >> build.xml file in the archive-all target. I get an error in the Foo >> project's build.xml file in the compile target. When I run the Bar >> project's build.xml file through Eclipse's debugger with a break point at >> the javac element in the Foo project's build.xml file, I notice that all >> of >> the properties in the Foo project's build.xml file are referencing the Bar >> project's path... I checked the basedir property for the Foo project's >> build.xml file to make sure it was being overrided with the dir attribute >> of >> the ant element in the Bar project's build.xml file and it is. However, >> when I look at the properties defined in the Foo project's build.xml file >> in >> the debugger (src.dir, etc) I notice that they are referencing directories >> in the Bar project and not the Foo project ("${basedir}/src" for example >> doesn't seem to be working). >> >> After all that, can anyone tell me what I'm doing wrong? Let me know if I >> need to clarify anything... :) >> >> -- >> Thanks! >> Bryan >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >