【问题标题】:symfony and Travis build composer errorsymfony 和 Travis 构建作曲家错误
【发布时间】:2015-07-10 13:15:03
【问题描述】:

也许你可以帮助我,我正在尝试设置 Travic-ci 帐户,但是在构建时我在 composer install 时遇到错误:

Generating autoload files
Updating the "app/config/parameters.yml" file

  [Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException]                 
  Circular reference detected for parameter "database_driver" ("database_driver" > "database_driver").  

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception

  [RuntimeException]                                                         
  An error occurred when executing the "'cache:clear --no-warmup'" command.  

我的 travis.yml:

language: php

php:

    - 5.5

before_script:

    - cp app/config/parameters.yml.dist app/config/parameters.yml
    - composer install

script:

    - phpunit -c app

composer.json:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/", "SymfonyStandard": "app/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.6.*",
        "doctrine/orm": "~2.2,>=2.2.3,<2.5",
        "doctrine/dbal": "<2.5",
        "doctrine/doctrine-bundle": "~1.2",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~3.0,>=3.0.12",
        "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "twbs/bootstrap": "3.3.*@dev",
        "components/jquery": "2.1.*",
        "doctrine/doctrine-fixtures-bundle": "2.2.*",
        "friendsofsymfony/user-bundle": "~2.0@dev"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3",
        "ongr/ongr-strict-standard": "~1.0",
        "squizlabs/php_codesniffer": "~1",
        "phpmd/phpmd": "@stable",
        "phpunit/phpunit": "4.6.*"
    },
    "scripts": {
        "post-root-package-install": [
            "SymfonyStandard\\Composer::hookRootPackageInstall"
        ],
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.6-dev"
        }
    }
}

parameters.yml.dist:

这个文件是你的parameters.yml文件应该看起来像参数的“模板”:

database_driver:   "%database_driver%"
database_host:     "%database_host%"
database_port:     "%database_port%"
database_name:     "%database_name%"
database_user:     "%database_user%"
database_password:  "%database_password%"
# You should uncomment this if you want use pdo_sqlite
# database_path: "%kernel.root_dir%/data.db3"

mailer_transport:  ~
mailer_host:       ~
mailer_user:       ~
mailer_password:   ~

locale:            en

# A secret key that's used to generate certain security-related tokens
secret:            ~

#keys for GoodReads and Amazon API
goodreads_key:      ~
amazon_key:         ~
amazon_secret_key:  ~
amazon_tag:         ~

【问题讨论】:

  • 您可以发布parameters.yml.dist 文件吗? PS:通常最好为 travis 制作一个特殊的参数,如 this 有用链接中所述的 parameters.ym.travis。希望对您有所帮助
  • 确实,发布您的参数文件。听起来您的 parameters.yml 正在尝试读取同名的环境变量。
  • parameters.yml.dist 添加

标签: php symfony composer-php


【解决方案1】:

所有以 %% 表示的变量都应设置为环境变量,这是您的 travis 构建/用户环境所缺少的。

【讨论】:

  • 你是对的,改变了它们,现在一切正常
猜你喜欢
  • 2019-06-03
  • 2019-05-10
  • 2018-03-20
  • 1970-01-01
  • 2021-08-07
  • 1970-01-01
  • 1970-01-01
  • 2019-11-28
  • 1970-01-01
相关资源
最近更新 更多