You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steve Cohen <SC...@sportvision.com> on 2003/05/27 16:21:06 UTC
running ant under cron
I am trying to run ant from cron to run an automated build script. The
script runs fine from the command line, but fails under cron.
It is a long, complicated, build script and it makes it all the way
through the actual build even under cron.
However, it next runs the <test> target and here it fails to compile the
test code, exiting with the error
"Modern compiler not found - looking for classic compiler"
It had no trouble finding the modern compiler during the build phase.
Ironically, this compile is the only compile I do which is NOT forked
(because I want to pull in the junit stuff on the ant classpath). What
am I doing wrong, or is there a better way to accomplish this whole
thing?
Here is the target that fails:
<javac srcdir="${dir.src.test}"
destdir="${dir.build.test}"
debug="on"
deprecation="on"
optimize="on">
<include name="**/*.java"/>
<classpath>
<pathelement location="${dir.build.java}"/>
<pathelement path="${java.class.path}"/>
<fileset refid="globallibs"/>
<fileset refid="buildlibs"/>
<fileset refid="testonlylibs"/>
</classpath>
</javac>
----------------------------------------------
Steve Cohen
Sr. Software Engineer
Sportvision Inc.
4410 N. Ravenswood Ave.
Chicago, IL 60640
(773)-293-4342
scohen@sportvision.com
http://www.sportvision.com
Re: running ant under cron
Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 27 May 2003, Steve Cohen <SC...@sportvision.com> wrote:
> Ironically, this compile is the only compile I do which is NOT
> forked
which is the reason that you've never seen the message for the other
tasks - Ant won't look for the modern compiler when forking, it just
invokes javac.
> What am I doing wrong,
My guess is that JAVA_HOME is not set in the environment running cron,
and thus Ant won't pull in tools.jar.
Stefan
Re: running ant under cron
Posted by Antoine Levy-Lambert <le...@tiscali-dsl.de>.
Usually, behaviour differences between cron and running a script from hand
are due to the fact that
cron does not automatically execute login scripts such as .profile under
Korn Shell.
Solution : make another shell script, which you use as a wrapper to run the
build under cron.
If your shell is Korn Shell, your wrapper should look like :
#!/bin/ksh
# source the profile with the dot command
. ~/.profile
# execute the main build script
main_build_script.ksh
then you change your crontab to call the wrapper instead of the main build
script.
the solution is similar under other shells (csh, tcsh, bash, ...)
Antoine
----- Original Message -----
From: "Steve Cohen" <SC...@sportvision.com>
To: "ant-user" <an...@jakarta.apache.org>
Sent: Tuesday, May 27, 2003 4:21 PM
Subject: running ant under cron
I am trying to run ant from cron to run an automated build script. The
script runs fine from the command line, but fails under cron.
It is a long, complicated, build script and it makes it all the way
through the actual build even under cron.
However, it next runs the <test> target and here it fails to compile the
test code, exiting with the error
"Modern compiler not found - looking for classic compiler"
It had no trouble finding the modern compiler during the build phase.
Ironically, this compile is the only compile I do which is NOT forked
(because I want to pull in the junit stuff on the ant classpath). What
am I doing wrong, or is there a better way to accomplish this whole
thing?
Here is the target that fails:
<javac srcdir="${dir.src.test}"
destdir="${dir.build.test}"
debug="on"
deprecation="on"
optimize="on">
<include name="**/*.java"/>
<classpath>
<pathelement location="${dir.build.java}"/>
<pathelement path="${java.class.path}"/>
<fileset refid="globallibs"/>
<fileset refid="buildlibs"/>
<fileset refid="testonlylibs"/>
</classpath>
</javac>
----------------------------------------------
Steve Cohen
Sr. Software Engineer
Sportvision Inc.
4410 N. Ravenswood Ave.
Chicago, IL 60640
(773)-293-4342
scohen@sportvision.com
http://www.sportvision.com
RE: running ant under cron
Posted by Adam Jack <aj...@TrySybase.com>.
I've had problems like this, and I think it is to do with your environment
not being the same when you run cron as when you log in. I suspect your PATH
or maybe CLASSPATH are not set, and hence when ant tries to load a compiler
from the JDK tools lib it can't find it. I'd stick an <echoproperties /> in
to your build, for starters, and then start looking at your environment to
see the difference when cron runs. Good luck.
regards
Adam
-----Original Message-----
From: Steve Cohen [mailto:SCohen@sportvision.com]
Sent: Tuesday, May 27, 2003 8:21 AM
To: ant-user
Subject: running ant under cron
I am trying to run ant from cron to run an automated build script. The
script runs fine from the command line, but fails under cron.
It is a long, complicated, build script and it makes it all the way
through the actual build even under cron.
However, it next runs the <test> target and here it fails to compile the
test code, exiting with the error
"Modern compiler not found - looking for classic compiler"
It had no trouble finding the modern compiler during the build phase.
Ironically, this compile is the only compile I do which is NOT forked
(because I want to pull in the junit stuff on the ant classpath). What
am I doing wrong, or is there a better way to accomplish this whole
thing?
Here is the target that fails:
<javac srcdir="${dir.src.test}"
destdir="${dir.build.test}"
debug="on"
deprecation="on"
optimize="on">
<include name="**/*.java"/>
<classpath>
<pathelement location="${dir.build.java}"/>
<pathelement path="${java.class.path}"/>
<fileset refid="globallibs"/>
<fileset refid="buildlibs"/>
<fileset refid="testonlylibs"/>
</classpath>
</javac>
----------------------------------------------
Steve Cohen
Sr. Software Engineer
Sportvision Inc.
4410 N. Ravenswood Ave.
Chicago, IL 60640
(773)-293-4342
scohen@sportvision.com
http://www.sportvision.com