Jenkins 没有构建我的 ant 项目
我刚刚开始使用 Jenkins,我只是想用它来执行 phpunit 测试。
我的步骤是:创建文件 build.xml,如这里所说:
<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>
所以,我执行了 ant 并得到了这个:
javier@javier-mbp:~/programacion/mbp/myfirm$ ant 构建文件: /home/javier/programacion/mbp/myfirm/build.xml
clean: [删除] 删除目录 /home/哈维尔/programacion/mbp/myfirm/build
准备: [mkdir] 创建目录:/home/javier/programacion/mbp/myfirm/build/logs
php单元: [执行] PHPUnit 3.6.4 由 Sebastian Bergmann 编写。 [执行] [exec] 从 /home/javier/programacion/mbp/myfirm/app/phpunit.xml 读取配置 [执行] [执行]............ [执行] [exec] 时间:6 秒,内存:157.50Mb [执行] 好的(15 个测试,18 个断言)
构建:
构建成功总时间:6 秒
然后我在 Jenkins 中创建了一个新作业,选择 git 存储库,如下所示:
文件:///home/javier/programacion/mbp/myfirm/
最后我构建了该项目,所以我希望看到与在没有 Jenkins 的情况下执行 ant
时相同的输出,但什么也没有。
在“Console Output”部分显示如下:
由用户匿名 Checkout 启动:workspace / /var/lib/jenkins/jobs/mbp2/workspace - hudson.remoting.LocalChannel@76996f0c 使用策略:默认最后 内置修订版:修订版 9aafeea09cdb23317f2426f8209c75341565c070 (原点/HEAD,原点/master)签出:工作区/ /var/lib/jenkins/jobs/mbp2/workspace - hudson.remoting.LocalChannel@76996f0c 从 1 个远程获取更改 Git 存储库从以下位置获取上游更改 file:///home/javier/programacion/mbp/myfirm 在存储库中看到分支 origin/HEAD 在存储库 origin/master 中看到分支开始构建修订版 9aafeea09cdb23317f2426f8209c75341565c070 (来源/HEAD,来源/主)检查修订 9aafeea09cdb23317f2426f8209c75341565c070(来源/HEAD,来源/主) 警告:这里有多个分支变更集已完成:成功
哈维尔
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.xmlclean: [delete] Deleting directory
/home/javier/programacion/mbp/myfirm/buildprepare:
[mkdir] Created dir: /home/javier/programacion/mbp/myfirm/build/logsphpunit:
[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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要添加
Ant
构建步骤。 Jenkins 不会做任何你不告诉它的事情。You need to add an
Ant
build step. Jenkins doesn't do anything you don't tell it to.Jenkins 中的 Ant 配置:
或者,您可以在 Windows 中执行 ant.bat,如下所示,而不是“调用 Ant”:
Ant configuration in Jenkins:
OR, You can execute ant.bat in Windows as below instead of "Invoke Ant":