Jenkins: Error during ant build step

9,736 views
Skip to first unread message

namtax

unread,
Jun 27, 2011, 10:06:29 AM6/27/11
to mxunit
Hi

I am going through the really useful wiki on setting up Jenkins with
coldfusion, I have got things running well but am getting an error
when I set up ant as a build step, as outlined here. http://bit.ly/iVKsYB

I have followed the instructions, but when i run the build after
configuring ant the build fails with this error

[workspace] $ cmd.exe /C '"ant.bat runTests && exit %%ERRORLEVEL%%"'
'ant.bat' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Invoke Ant' marked build as failure.

Im not sure what this means, wondered if anyone could assist.

Cheers

Jim Priest

unread,
Jun 27, 2011, 10:25:49 AM6/27/11
to mxu...@googlegroups.com
Did you see the very last section on that page "Re-saving ant.bat"

And were you able to run the Ant file by itself? per the Assumptions:

"Assumptions

I'm assuming you successfully completed the prior step and can run
your tests from ANT, either within your IDE or at the command line.
Don't bother proceeding until you've done so."

I recently setup Jenkins at work and don't think I actually used a
batch file for anything....

Jim

namtax

unread,
Jun 27, 2011, 10:31:16 AM6/27/11
to mxunit
Hi Jim.

Yeah my tests are running successfully via ant at the commandline.

I followed the tutorial step by step.

Cheers

Randy Merrill

unread,
Jun 27, 2011, 10:55:48 AM6/27/11
to mxu...@googlegroups.com
I haven't set it up on windows before, but in the jenkins admin settings there is a setting for defining where your ant is installed. It may be that your ant is setup in a custom location or it is having trouble finding it.
--
Randy Merrill

namtax

unread,
Jun 27, 2011, 11:56:40 AM6/27/11
to mxunit
Hi randy.

I have set up ant in the jenkins config settings.

Ant name = ant
ANT_HOME = c:\ant

Thanks

namtax

unread,
Jun 28, 2011, 10:45:09 AM6/28/11
to mxunit
Wondered if anyone else would be able to assist.

Would be much appreciated.

Jim Priest

unread,
Jun 28, 2011, 10:54:36 AM6/28/11
to mxu...@googlegroups.com
Where were you stuck again?  I'm at work today and can access my Jenkins setup:

My Ant config in Jenkins is the same as Randy:

Name: Ant
ANT_HOME: X:\ant

Then within my Jenkins project I have:

Build
-------------------------
Invoke Ant
Ant Version: Ant (refers to 'name' defined above)
Targets: BUILD-TESTS (refers to the target in my build.xml file)
Build File: _build\build.xml (click advanced button to see this field)


And my Ant BUILD-TESTS target looks like:
<target name="BUILD-TESTS" depends="runtests,junitreport" />

<target name="runtests" description="Make output directories and run
the MXUnit task">
<mkdir dir="${junit.out.dir.html}" />
<mkdir dir="${output.dir}" />

<mxunittask server="${test.url}"
defaultrunner="${test.directory}/_test/HttpAntRunner.cfc"
outputdir="${output.dir}" verbose="true"
testResultsSummary="my.summary">
<directory path="${web.root}myproject/_test" recurse="true"
componentpath="myproject._tests"/>
</mxunittask>
</target>


Jim

namtax

unread,
Jun 28, 2011, 11:32:24 AM6/28/11
to mxunit
Hi, really appreciate this.

Ok

My Ant config is

Name: Ant
ANT_HOME: C:\ant

Then in my project, I have set up as

Invoke Ant
Ant Version: *** I dont have the option to choose ant version ***
Targets: runTests
Build File: build.xml


And my runtests in the build.xml

<target name="runtests" description="Make output directories and
run the MXUnit task" depends="init">

<taskdef name="mxunittask" classname="org.mxunit.ant.MXUnitAntTask"
classpathref="project.classpath" />
<mxunittask server="${test.server}" port="${test.serverport}"
defaultrunner="${test.runner}" verbose="true">
<directory path="\project\www\tests\units\skins" recurse="true"
packageName="${test.cfcpath}" componentPath="$
{test.cfcpath}.units.skins" />
</mxunittask>

</target>

But when i run, i get the errror.

[workspace] $ cmd.exe /C '"ant.bat -file build.xml runtests && exit %
%ERRORLEVEL%%"'
'ant.bat' is not recognized as an internal or external command,

Randy Merrill

unread,
Jun 28, 2011, 11:49:56 AM6/28/11
to mxu...@googlegroups.com
I just double checked my jenkins and I don't see the option to select the ant either. Probably because there is only one defined in the jenkins configuration. I'm currently running jenkins 1.417.

Here is what shows under my manage jenkins screen for the ant:

Ant.png

--
Randy Merrill
Ant.png

Jim Priest

unread,
Jun 28, 2011, 11:56:44 AM6/28/11
to mxu...@googlegroups.com
Interesting - I just looked and now there is an "Add Ant" button which displays the dialog in your screenshot below...  don't remember that being there when I installed it :)  Maybe a update?

So you are probably fine if you just have one instance of Ant configured...

Jim
Ant.png

Jim Priest

unread,
Jun 28, 2011, 11:57:25 AM6/28/11
to mxu...@googlegroups.com
What was the MXUnit page you were following? I have no idea where
it's getting the reference to the ant.bat file...

namtax

unread,
Jun 28, 2011, 12:13:40 PM6/28/11
to mxunit
This one.

http://wiki.mxunit.org/display/default/Continuous+Integration+--+Running+tests+with+Jenkins

I can send over files, or show a screencast of the system if that
might help.

Just unsure why its breaking at this stage, and really keen to get
jenkins running.

Cheers

Jim Priest

unread,
Jun 28, 2011, 12:43:23 PM6/28/11
to mxu...@googlegroups.com
OK. Something is borked with your Jenkins config - I was looking
through my Jenkins console output and see this from one of my builds:

[_build] $ cmd.exe /C '"X:\ant\bin\ant.bat -file build.xml BUILD-TESTS
&& exit %%ERRORLEVEL%%"'

Note the ANT_HOME is appended to the ant.bat...

I'm not sure if this matters but do you have an ANT_HOME environment
variable setup (I'm in Windows and have :

ALLUSERSPROFILE=C:\ProgramData
ANT_HOME=X:\ant <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
APPDATA=C:\Users\jdpriest\AppData\Roaming

Jim

> --
> You received this message because you are subscribed to the Google Groups "mxunit" group.
> To post to this group, send email to mxu...@googlegroups.com.
> To unsubscribe from this group, send email to mxunit+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mxunit?hl=en.
>
>

Randy Merrill

unread,
Jun 28, 2011, 1:00:32 PM6/28/11
to mxu...@googlegroups.com
I would suggest removing the ant from the config and maybe redoing it. Either by letting jenkins use the apache version automatically or redoing the local ant configuration and see if that helps. 

Using the apache one in the screenshot I just see this on Linux in the console output: [workspace] $ ant

And yeah, that UI has definitely changed from when I originally installed jenkins (hudson back then).

--
Randy Merrill

Marc Esher

unread,
Jun 28, 2011, 2:45:38 PM6/28/11
to mxu...@googlegroups.com
that looks to me like ANT isn't properly configured in the "manage
jenkins" screen, because it *should* prepend that full path to
"ant.bat". I'd suggest trying to reconfigure, as Randy suggested.

In your build step, are you sure you don't have a dropdown that lets
you choose the ant install?

SJG

unread,
Jun 28, 2011, 3:52:09 PM6/28/11
to mxunit

I just hit this same issue today, after having previously set up
hudson/jenkins in the past without issue. Turns out, this is a known
bug in the current (1.416-1.418) versions of Jenkins:
https://issues.jenkins-ci.org/browse/JENKINS-10036

It has already been fixed and will be part of 1.419, which won't be
out until next week. However, you can grab the RC version now from
http://ci.jenkins-ci.org/job/jenkins_rc_branch/lastSuccessfulBuild/artifact/war/target/jenkins.war.
This will restore the missing "ANT Version" dropdown, after which it
will correctly prepend the full path :)

Very confusing bug to stumble upon when dealing with a fresh install!

On Jun 28, 1:45 pm, Marc Esher <marc.es...@gmail.com> wrote:
> that looks to me like ANT isn't properly configured in the "manage
> jenkins" screen, because it *should* prepend that full path to
> "ant.bat". I'd suggest trying to reconfigure, as Randy suggested.
>
> In your build step, are you sure you don't have a dropdown that lets
> you choose the ant install?
>
>
>
>
>
>
>
> On Mon, Jun 27, 2011 at 10:06 AM, namtax <nam...@googlemail.com> wrote:
> > Hi
>
> > I am going through the really useful wiki on setting up Jenkins with
> > coldfusion, I have got things running well but am getting an error
> > when I set up ant as a build step, as outlined here.http://bit.ly/iVKsYB

Marc Esher

unread,
Jun 28, 2011, 4:01:16 PM6/28/11
to mxu...@googlegroups.com
Excellent! Thanks for the information.

Marc

namtax

unread,
Jun 29, 2011, 5:11:55 AM6/29/11
to mxunit
YES YES YES YES YES!
This was it!
Its working now.
Massive thanks mate.

On Jun 28, 8:52 pm, SJG <scott.geertg...@gmail.com> wrote:
> I just hit this same issue today, after having previously set up
> hudson/jenkins in the past without issue. Turns out, this is a known
> bug in the current (1.416-1.418) versions of Jenkins:https://issues.jenkins-ci.org/browse/JENKINS-10036
>
> It has already been fixed and will be part of 1.419, which won't be
> out until next week. However, you can grab the RC version now fromhttp://ci.jenkins-ci.org/job/jenkins_rc_branch/lastSuccessfulBuild/ar....
Reply all
Reply to author
Forward
0 new messages