tirenweb
tirenweb

Reputation: 31709

Jenkins does not build my ant project

I've just started with Jenkins and I'm just trying to use it to execute phpunit tests.

My steps are: create the file build.xml as here says:

<project name="mbp2" default="build">
 <target name="clean">
  <delete dir="${basedir}/build"/>
 </target>

 <target name="prepare">
  <mkdir dir="${basedir}/build/logs"/>
 </target>

 <target name="phpunit">
  <exec dir="${basedir}" executable="phpunit">
   <arg line="-c app --log-junit ${basedir}/build/logs/phpunit.xml src/MyFirm/FrontendBundle/Tests" />
  </exec>
 </target>

 <target name="build" depends="clean,prepare,phpunit"/>
</project>

So, I executed ant and I got this:

javier@javier-mbp:~/programacion/mbp/myfirm$ ant Buildfile: /home/javier/programacion/mbp/myfirm/build.xml

clean: [delete] Deleting directory /home/javier/programacion/mbp/myfirm/build

prepare: [mkdir] Created dir: /home/javier/programacion/mbp/myfirm/build/logs

phpunit: [exec] PHPUnit 3.6.4 by Sebastian Bergmann. [exec] [exec] Configuration read from /home/javier/programacion/mbp/myfirm/app/phpunit.xml [exec] [exec] ............... [exec] [exec] Time: 6 seconds, Memory: 157.50Mb [exec] OK (15 tests, 18 assertions)

build:

BUILD SUCCESSFUL Total time: 6 seconds

Then I created a new job in Jenkins choosing as git repository as below:

file:///home/javier/programacion/mbp/myfirm/

Finally I built the project, so I expected to see the same output as when I executed ant without Jenkins, but nothing about that..

In the "Console Output" section showed as below:

Started by user anonymous Checkout:workspace / /var/lib/jenkins/jobs/mbp2/workspace - hudson.remoting.LocalChannel@76996f0c Using strategy: Default Last Built Revision: Revision 9aafeea09cdb23317f2426f8209c75341565c070 (origin/HEAD, origin/master) Checkout:workspace / /var/lib/jenkins/jobs/mbp2/workspace - hudson.remoting.LocalChannel@76996f0c Fetching changes from 1 remote Git repository Fetching upstream changes from file:///home/javier/programacion/mbp/myfirm Seen branch in repository origin/HEAD Seen branch in repository origin/master Commencing build of Revision 9aafeea09cdb23317f2426f8209c75341565c070 (origin/HEAD, origin/master) Checking out Revision 9aafeea09cdb23317f2426f8209c75341565c070 (origin/HEAD, origin/master) Warning : There are multiple branch changesets here Finished: SUCCESS

Javier

Upvotes: 0

Views: 2169

Answers (2)

Ripon Al Wasim
Ripon Al Wasim

Reputation: 37746

Ant configuration in Jenkins:

  1. Run Jenkins and browse it
  2. Click the link of your project/job name --> Click Configure link at the left
  3. Click "Add build step" combo and select "Invoke Ant" from combo
  4. Fill up necessary fields for Ant configuration and save it

OR, You can execute ant.bat in Windows as below instead of "Invoke Ant":

  1. Run Jenkins and browse it
  2. Click the link of your project/job name --> Click Configure link at the left
  3. Click "Add build step" combo and select "Execute Windows batch command" from combo
  4. Write the proper command (In my case it was: C:\apache-ant-1.8.4\bin\ant.bat) and save it

Upvotes: 1

Yann Ramin
Yann Ramin

Reputation: 33167

You need to add an Ant build step. Jenkins doesn't do anything you don't tell it to.

Upvotes: 2

Related Questions