在Jenkins for PHP中运行Ant构建时获取错误= 13

时间:2014-06-13 06:01:17

标签: php ant jenkins

我正在使用jenkins ci for php并关注http://jenkins-php.org/index.html

对于jenkins我已配置并开始使用相同的项目资金(链接:https://github.com/sebastianbergmann/money

在jenkins建立我的工作后,构建崩溃了。请在控制台输出下面找到相同的内容:

如果您需要更多详细信息,请与我们联系。

Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/Jenkins-PHP/workspace
Cloning the remote Git repository
Cloning repository http://manojshe@172.27.56.81:7990/scm/tes/money.git
 > /usr/bin/git init /var/lib/jenkins/jobs/Jenkins-PHP/workspace
Fetching upstream changes from http://manojshe@172.27.56.81:7990/scm/tes/money.git
 > /usr/bin/git --version
using .gitcredentials to set credentials
 > /usr/bin/git config --local credential.helper store --file=/tmp/git1537427597399873705.credentials
Setting http proxy: http://172.27.171.92:8080/
 > /usr/bin/git fetch --tags --progress http://manojshe@172.27.56.81:7990/scm/tes/money.git +refs/heads/*:refs/remotes/origin/*
 > /usr/bin/git config --local --remove-section credential
 > /usr/bin/git config remote.origin.url http://manojshe@172.27.56.81:7990/scm/tes/money.git
 > /usr/bin/git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
 > /usr/bin/git config remote.origin.url http://manojshe@172.27.56.81:7990/scm/tes/money.git
Fetching upstream changes from http://manojshe@172.27.56.81:7990/scm/tes/money.git
using .gitcredentials to set credentials
 > /usr/bin/git config --local credential.helper store --file=/tmp/git8429183869423354745.credentials
Setting http proxy: http://172.27.171.92:8080/
 > /usr/bin/git fetch --tags --progress http://manojshe@172.27.56.81:7990/scm/tes/money.git +refs/heads/*:refs/remotes/origin/*
 > /usr/bin/git config --local --remove-section credential
 > /usr/bin/git rev-parse origin/master^{commit}
Checking out Revision df5c32073a42c94deec649078910a0f3f9200900 (origin/master)
 > /usr/bin/git config core.sparsecheckout
 > /usr/bin/git checkout -f df5c32073a42c94deec649078910a0f3f9200900
 > /usr/bin/git rev-list df5c32073a42c94deec649078910a0f3f9200900
[workspace] $ ant
Buildfile: build.xml

clean:

generate-code:

BUILD FAILED
  /var/lib/jenkins/jobs/Jenkins-PHP/workspace/build.xml:21: 
  Execute failed: 
  java.io.IOException: 
  Cannot run program "/var/lib/jenkins/jobs/Jenkins-PHP/workspace/build/generate-child-classes.php": 
  error=13, Permission denied

或像这样的错误

/var/lib/jenkins/jobs/Jenkins-PHP/workspace/build.xml:21: Execute failed: java.io.IOException: Cannot run program "/var/lib/jenkins/jobs/Jenkins-PHP/workspace/build/generate-child-classes.php": error=13, Permission denied

1 个答案:

答案 0 :(得分:1)

通过修改ant脚本解决了获得权限被拒绝的问题。

我在ant脚本中添加了2个chmod行,如下所示。

<chmod file="${basedir}/build/generate-child-classes.php" perm="ugo+x"/>
<chmod file="${basedir}/build/tools/**" perm="ugo+x"/>

这些行在生成代码目标中添加为:

<target name="generate-code" description="Generate Currency-specific subclasses of Money and autoloader code">
 <chmod file="${basedir}/build/generate-child-classes.php" perm="ugo+x"/>
<chmod file="${basedir}/build/tools/**" perm="ugo+x"/>
  <exec executable="${basedir}/build/generate-child-classes.php"/>

  <exec executable="${basedir}/build/tools/phpab.phar">
   <arg value="--output" />
   <arg path="src/autoload.php" />
   <arg path="src" />
  </exec>
 </target>