dongzilu0178 2019-01-31 01:43
浏览 344

Composer找不到配置文件 - 在Windows上使用Jenkins

I have an Ant build script that is trying to execute Composer install but I get this error when executed through Jenkins:

     [exec] Composer could not find the config file: C:\ProgramData\ComposerSetup\bin
     [exec] To initialize a project, please create a composer.json file as described in the "Getting Started" section
     [exec] Result: 1
     [echo] composer update complete

Here is the target from Ant:

<target name="self-update"
        description="Self-update Composer">
    <echo message="Self-updating composer" level="debug"/>
    <exec executable="${composer.phar}">
        <arg value="self-update" />
        <arg value="--quiet" />
        <arg value="--no-interaction" />
    <echo message="composer self-update complete" level="debug"/>

However, this works fine when running the Ant build locally.

Some people say to delete the environment variables that the composer installer sets; however it does not seem to change anything.

  • 写回答

1条回答 默认 最新

  • dongmi5177 2019-02-12 14:01

    There was an environment variable named COMPOSER that was set to C:\ProgramData\ComposerSetup\bin. The variable was not visible through the Environment Variables control panel.

    I could work around this by setting the env key="composer" to "".

    <target name="composer"
            depends="init, self-install, self-update"
        <condition property="composer.command" value="update" else="install">
            <available file="${composer.lock}"/>
        <echo message="Beginning composer ${composer.command}" level="debug"/>
        <exec executable="php">
            <env key="composer" value=""/>
            <arg value="${composer.phar}"/>
            <arg value="${composer.command}"/>
            <arg value="--verbose"/>
            <arg value="--no-interaction"/>
            <arg value="--optimize-autoloader"/>
            <arg value="--prefer-dist"/>
        <echo message="composer ${composer.command} complete" level="debug"/>

    It's also possible set it to composer.json.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止