You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by starkc <st...@tessco.com> on 2009/07/10 16:35:28 UTC

ant unable to find build.xml in another directory?

As part of compiling my projects in windows, I am required to execute a
second ant task, defined in my build.xml as follows:

<target name="maint">
	<exec failonerror="yes" executable="ant.bat" dir="../maintenance">
  <arg value="ejb"/>
  </exec>
</target>

However, every time I try to run this, I get the following error:

maint:
     [exec] Buildfile: build.xml does not exist!
     [exec] Build failed

However, if I go to that directory and specificially run ant in it, it will
compile correctly.  I have tried running ant with the -verbose and -debug
flags, and there is no extra information given about the situation, and have
tried adding <echo> statements in the build.xml to see what directory ant is
looking for the build.xml, to no avail.  This feels like a path problem of
some kind, but I seem to have everything set up properly...

My environment variables are set as follows:
JAVA_HOME  = C:\jdk1.5.0
ANT_HOME = c:\dev-jboss\ant
PATH = [snip] c:\dev-jboss\ant\bin;

Running Ant version: Apache Ant version 1.5.1 compiled on October 2 2002


Any help would be appreciated.
-- 
View this message in context: http://www.nabble.com/ant-unable-to-find-build.xml-in-another-directory--tp24428338p24428338.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by starkc <st...@tessco.com>.


Stefan Bodewig wrote:
> 
> On 2009-07-10, starkc <st...@tessco.com> wrote:
> 
>> Stefan Bodewig wrote:
> 
> Maybe there is an ant.bat somewhere prior to c:\dev-jboss\ant\bin in
> your PATH?
> 
> 

So far I have been unable to locate any other ant.bat in the path that would
interfere.  The one possible exception is that the script being used to
actually set up the build environment is called ant.bat, but it specifies
command line options that I believe run ant (-Dant.home="c:\dev-jboss\ant",
etc...).  Not sure on this though.  Ant certainly runs, just not from other
directories...

The scenario I will try to strip down is as follows:  The local ant.bat
calls setenv.bat (which sets up environment variables only), and then calls
java with the specific ant command line parameters.  From there, the
ant+build.xml takes over, if I understand correctly how this works.
-- 
View this message in context: http://www.nabble.com/ant-unable-to-find-build.xml-in-another-directory--tp24428338p24462827.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-07-10, starkc <st...@tessco.com> wrote:

> Stefan Bodewig wrote:

>> On 2009-07-10, starkc <st...@tessco.com> wrote:

>>> As part of compiling my projects in windows, I am required to execute a
>>> second ant task, defined in my build.xml as follows:

>>> <target name="maint">
>>> 	<exec failonerror="yes" executable="ant.bat" dir="../maintenance">
>>>   <arg value="ejb"/>
>>>   </exec>
>>> </target>

>> See the "Windows Users" section at the top of
>> http://ant.apache.org/manual/CoreTasks/exec.html

> Adding the "/c" flag resulted in the same error, no change.

Well, it works for me.

> This same command seems to work for the rest of my team, and not me,
> which leads me to further believe this is somehow a setup problem.

Quite likely.

> PATH = C:\jdk1.5.0\bin;.;C:\j2sdk1.4.2_15\bin;C:\oracle\ora92\bin;C:\Program
> Files\Oracle\jre\1.3.1\bin;C:\Program
> Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
> Files\Intel\DMIX;C:\Program Files\Seapine\Surround SCM;C:\Program
> Files\QuickTime\QTSystem\;c:\python24;C:\Program
> Files\Git\cmd;c:\dev-jboss\ant\bin;

Maybe there is an ant.bat somewhere prior to c:\dev-jboss\ant\bin in
your PATH?

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by Dominique Devienne <dd...@gmail.com>.
On Fri, Jul 10, 2009 at 1:51 PM, starkc<st...@tessco.com> wrote:
> I agree that it seems to be going into the wrong directory...but where could it be going?

Do you have a non-standard ant.bat somewhere in your path? Or from a
different install?

Have you tried calling the same DOS command at the DOS prompt to see
if it fails similarly?
(i.e. take Ant out of the equation). Do you have a dir attribute on
your <project>? If yes, run
the command from that dir at the DOS prompt too.

Maybe you can add -verbose:class on the JVM's command line and make sure you are
picking up the Ant jars from where you think they are coming from?
Such options have to
be passed via env vars I believe, don't recall the name. But that's
getting into the weeds.

Have you tried creating another Ant build that does *just* the <exec>
to the other build
to reduce the number of moving pieces? --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by starkc <st...@tessco.com>.


ddevienne wrote:
> 
> On Fri, Jul 10, 2009 at 1:28 PM, starkc<st...@tessco.com> wrote:
>> Using "-f [path-to-buildfile]" worked, but it seems like there should be
>> a
>> way for me to do this without resorting to absolute paths.  Shouldn't
>> this
>> be somewhat portable?
> 
> You could try adding -verbose or -debug to the sub-Ant process.
> Maybe the output will show the actual current directory? --DD
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

Unfortunately, both -verbose and -debug resulted in the following output:

maint:
     [exec] Build failed
     [exec] Apache Ant version 1.5.1 compiled on October 2 2002
     [exec] Buildfile: build.xml does not exist!

...which doesn't help us out a whole lot :(

I agree that it seems to be going into the wrong directory...but where could
it be going?

-- 
View this message in context: http://www.nabble.com/ant-unable-to-find-build.xml-in-another-directory--tp24428338p24432693.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by Dominique Devienne <dd...@gmail.com>.
On Fri, Jul 10, 2009 at 1:28 PM, starkc<st...@tessco.com> wrote:
> Using "-f [path-to-buildfile]" worked, but it seems like there should be a
> way for me to do this without resorting to absolute paths.  Shouldn't this
> be somewhat portable?

You could try adding -verbose or -debug to the sub-Ant process.
Maybe the output will show the actual current directory? --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by starkc <st...@tessco.com>.


ddevienne wrote:
> 
> On Fri, Jul 10, 2009 at 10:31 AM, starkc<st...@tessco.com> wrote:
>> Here is the resulting log when running that new command with the -verbose
>> flag.  I dont believe I missed anything...
>>
>> maint:
>>     [exec] Current OS is Windows XP
>>     [exec] Executing 'cmd' with arguments:
>>     [exec] '/c'
>>     [exec] 'ant.bat'
>>     [exec] 'ejb'
>>     [exec]
>>     [exec] The ' characters around the executable and arguments are
>>     [exec] not part of the command.
>>     [exec] Buildfile: build.xml does not exist!
>>     [exec] Build failed
> 
> It doesn't say in which directory it executes the command. I thought
> it did, strange.
> The error message indicates to me the sub-process's current directory
> is not what
> it should be, although I'm not sure as to why.
> 
> Work-around it using a command line like "cmd /c cd /d absdir && ..."
> (basically what
> WinNTCommandLauncher does in the latest code), or by adding an explicit
> build
> file arg with an absolute path (see
> http://ant.apache.org/manual/running.html and -f)
> 
> You may also want to play with the vmlauncher attribute. --DD
> 
> PS: Use <property location> to generate absolute filenames.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

Using "-f [path-to-buildfile]" worked, but it seems like there should be a
way for me to do this without resorting to absolute paths.  Shouldn't this
be somewhat portable?

My main concern is that everyone else on my team has this working just the
way it is, and I do not.  It seems like it must be a versioning issue or
environment issue, not the way the build.xml is structured...

-- 
View this message in context: http://www.nabble.com/ant-unable-to-find-build.xml-in-another-directory--tp24428338p24432496.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by Dominique Devienne <dd...@gmail.com>.
On Fri, Jul 10, 2009 at 10:31 AM, starkc<st...@tessco.com> wrote:
> Here is the resulting log when running that new command with the -verbose
> flag.  I dont believe I missed anything...
>
> maint:
>     [exec] Current OS is Windows XP
>     [exec] Executing 'cmd' with arguments:
>     [exec] '/c'
>     [exec] 'ant.bat'
>     [exec] 'ejb'
>     [exec]
>     [exec] The ' characters around the executable and arguments are
>     [exec] not part of the command.
>     [exec] Buildfile: build.xml does not exist!
>     [exec] Build failed

It doesn't say in which directory it executes the command. I thought
it did, strange.
The error message indicates to me the sub-process's current directory
is not what
it should be, although I'm not sure as to why.

Work-around it using a command line like "cmd /c cd /d absdir && ..."
(basically what
WinNTCommandLauncher does in the latest code), or by adding an explicit build
file arg with an absolute path (see
http://ant.apache.org/manual/running.html and -f)

You may also want to play with the vmlauncher attribute. --DD

PS: Use <property location> to generate absolute filenames.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by starkc <st...@tessco.com>.

Stefan Bodewig wrote:
> 
> On 2009-07-10, starkc <st...@tessco.com> wrote:
> 
>> As part of compiling my projects in windows, I am required to execute a
>> second ant task, defined in my build.xml as follows:
> 
>> <target name="maint">
>> 	<exec failonerror="yes" executable="ant.bat" dir="../maintenance">
>>   <arg value="ejb"/>
>>   </exec>
>> </target>
> 
> See the "Windows Users" section at the top of
> http://ant.apache.org/manual/CoreTasks/exec.html
> 
> Stefan
> 
> 

Adding the "/c" flag resulted in the same error, no change.

Here is the resulting log when running that new command with the -verbose
flag.  I dont believe I missed anything...

maint:
     [exec] Current OS is Windows XP
     [exec] Executing 'cmd' with arguments:
     [exec] '/c'
     [exec] 'ant.bat'
     [exec] 'ejb'
     [exec]
     [exec] The ' characters around the executable and arguments are
     [exec] not part of the command.
     [exec] Buildfile: build.xml does not exist!
     [exec] Build failed


The original command with -verbose:
maint:
     [exec] Current OS is Windows XP
     [exec] Executing 'ant.bat' with arguments:
     [exec] 'ejb'
     [exec]
     [exec] The ' characters around the executable and arguments are
     [exec] not part of the command.
     [exec] Buildfile: build.xml does not exist!
     [exec] Build failed

The old ant version is because thats what my entire team is using, and
upgrading at this time may or may not introduce problems I'm not available
to tackle.  This same command seems to work for the rest of my team, and not
me, which leads me to further believe this is somehow a setup problem.  To
that end, here is the PATH that is set by the script I use to run ant:

ANT_HOME   = c:\dev-jboss\ant
JAVA_HOME  = C:\jdk1.5.0
PATH = C:\jdk1.5.0\bin;.;C:\j2sdk1.4.2_15\bin;C:\oracle\ora92\bin;C:\Program
Files\Oracle\jre\1.3.1\bin;C:\Program
Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\Intel\DMIX;C:\Program Files\Seapine\Surround SCM;C:\Program
Files\QuickTime\QTSystem\;c:\python24;C:\Program
Files\Git\cmd;c:\dev-jboss\ant\bin;

Hopefully this helps...thanks in advance.
-- 
View this message in context: http://www.nabble.com/ant-unable-to-find-build.xml-in-another-directory--tp24428338p24429737.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-07-10, starkc <st...@tessco.com> wrote:

> As part of compiling my projects in windows, I am required to execute a
> second ant task, defined in my build.xml as follows:

> <target name="maint">
> 	<exec failonerror="yes" executable="ant.bat" dir="../maintenance">
>   <arg value="ejb"/>
>   </exec>
> </target>

See the "Windows Users" section at the top of
http://ant.apache.org/manual/CoreTasks/exec.html

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: ant unable to find build.xml in another directory?

Posted by Dominique Devienne <dd...@gmail.com>.
On Fri, Jul 10, 2009 at 9:35 AM, starkc<st...@tessco.com> wrote:
> As part of compiling my projects in windows, I am required to execute a
> second ant task, defined in my build.xml as follows:
>
> <target name="maint">
>        <exec failonerror="yes" executable="ant.bat" dir="../maintenance">
>  <arg value="ejb"/>
>  </exec>
> </target>

Why exec rather than <ant>?

> compile correctly.  I have tried running ant with the -verbose and -debug
> flags, and there is no extra information given about the situation,

Normally verbose mode shows the exact command line used and
the current dir so this is very surprising. You may have missed it in the sea
of unrelated messages. Have a closer look please.

> Running Ant version: Apache Ant version 1.5.1 compiled on October 2 2002

Why such an old Ant version? --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org