简体   繁体   English

作曲家在错误的路径中安装了自己的TYPO3扩展

[英]composer installs own TYPO3 extension in wrong path

I have a own TYPO3 extension hosted on bitbucket. 我在Bitbucket上托管了自己的TYPO3扩展。 Getting this via composer works ( see here for input ). 通过作曲家获得此作品( 请参阅此处输入 )。 The extension is downloaded into my vendor folder. 该扩展名已下载到我的供应商文件夹中。 Being there i cannot install the extension via extension-manager. 在那里,我无法通过扩展管理器安装扩展。

How can I getting my ext into typo3conf/ext (ensuring autoloading will work)? 如何将我的ext放入typo3conf / ext中(确保可以自动加载)?

The extensions coming via 扩展名来自

{
"type": "composer",
"url": "http://composer.typo3.org/"
}

are going to (as expected): 将(如预期的那样):

web/typo3config/ext 

here is my project composer.json: 这是我的项目composer.json:

{
  "repositories": [
        {
            "type": "composer",
            "url": "http://composer.typo3.org/"
        },
        {
            "type": "package",
            "package": {
                "name": "metaxos/exaibbrplus",
                "version": "dev-2016",
                "source": {
                    "url": "https://metaxos@bitbucket.org/metaxos/exaibbrplus.git",
                    "type": "git",
                    "reference": "release/2016"
                }
            }
        }
    ],
  "name": "Metaxos/ibbrating2016",
  "require": {
    "typo3/cms": "7.6.2",
    "bk2k/bootstrap-package" : "dev-master",
    "typo3-ter/compatibility6" : "7.6.0",
    "typo3-ter/extension-builder" : "7.6.0",
    "metaxos/exaibbrplus": "dev-2016"
  },
  "extra": {
    "typo3/cms": {
      "cms-package-dir": "{$vendor-dir}/typo3/cms",
      "web-dir": "web"
    }
  }
} 

here is my extension composer.json: 这是我的扩展名composer.json:

{
  "name": "metaxos/exaibbrplus",
  "description": "custom ext for typo3",
  "type": "typo3-cms-extension",
  "version": "0.0.1",
  "require": {
    "typo3/cms-core": ">=7.6.0,<8.0"
  },
  "replace": {
    "extkey": "self.version",
    "typo3-ter/extkey": "self.version"
  },
  "autoload": {
    "psr-4": {
      "Metaxos\\Exaibbrplus\\": "Classes/"
    }
  },
  "keywords": ["custom", "ext"],
  "homepage": "http://www.blah.ch"
}

For Composer to install the package in web/typo3conf/ext , the package needs to have the type typo3-cms-extension . 为了使Composer将该软件包安装在web/typo3conf/ext ,该软件包必须具有typo3-cms-extension类型。 In your extension's composer.json this type is actually declared, however Composer will not respect it because you explicitly declare the package configuration in your project-level composer.json : 实际上,在扩展程序的composer.json声明了这种类型,但是Composer将不尊重这种类型,因为您在项目级composer.json显式声明了包配置:

"repositories": [
  # ...
  {
    "type": "package",
    "package": {
      "name": "metaxos/exaibbrplus",
      "version": "dev-2016",
      "source": {
        "url": "https://metaxos@bitbucket.org/metaxos/exaibbrplus.git",
        "type": "git",
        "reference": "release/2016"
      }
    }
  }
]

As you're using "type": "package" for your own repository, I suspect that Composer ignores the composer.json from that package. 当您在自己的存储库中使用"type": "package" ,我怀疑Composer会忽略该软件包中的composer.json As you already have a Git repository that contains a composer.json , I'd suggest adding the repository using the vcs type instead: 由于您已经拥有一个包含composer.json的Git存储库,因此建议您使用vcs类型添加存储库:

"repositories": [
  {
    "type": "vcs",
    "url": "https://metaxos@bitbucket.org/metaxos/exaibbrplus.git"
  }
]

When doing that, Composer should use the composer.json from that repository, recognize the correct package type ( typo3-cms-extension ) and install the package in the correct directory. 这样做时,Composer应该使用该存储库中的composer.json,识别正确的软件包类型( typo3-cms-extension )并将该软件包安装在正确的目录中。

You need to add the type key with the value typo3-cms-extension to the root composer.json . 您需要将值为typo3-cms-extensiontype密钥添加到根composer.json This will place your extension in web/typo3conf/ext instead of vendor/$vendor/$package which in turn will make it available to the cms. 这会将您的扩展名放在web/typo3conf/ext而不是vendor/$vendor/$package ,这将使扩展名可用于cms。

It is important, to know that if you redefine the package in the root composer.json as repository type package , nothing from the extensions' composer.json file will be taken into account and you need to define any concerns about that package in the root composer.json . 重要的是要知道,如果将根目录composer.json中的软件包重新定义为repository类型package ,则不会考虑扩展程序的composer.json文件中的任何内容,并且您需要在根目录中定义对该软件包的任何关注composer.json

So-applying the rules I mentioned above, your root composer.json will look like that: 因此,应用我上面提到的规则,您的根composer.json将如下所示:

{ "repositories": [ { "type": "composer", "url": "http://composer.typo3.org/" }, { "type": "package", "package": { "name": "metaxos/exaibbrplus", "version": "dev-2016", "type": "typo3-cms-extension", "source": { "url": "https://metaxos@bitbucket.org/metaxos/exaibbrplus.git", "type": "git", "reference": "release/2016" }, "autoload": { "psr-4": { "Metaxos\\\\Exaibbrplus\\\\": "Classes/" } }, } } ], "name": "Metaxos/ibbrating2016", "require": { "typo3/cms": "7.6.2", "bk2k/bootstrap-package" : "dev-master", "typo3-ter/compatibility6" : "7.6.0", "typo3-ter/extension-builder" : "7.6.0", "metaxos/exaibbrplus": "dev-2016" }, "extra": { "typo3/cms": { "cms-package-dir": "{$vendor-dir}/typo3/cms", "web-dir": "web" } } }

As mentioned above by @helmbert, you are either left with completely redefining the package or using another repository type. 如@helmbert所述,您要么完全重新定义了软件包,要么使用其他存储库类型。 You may want to consider using satis or a URL repository. 您可能要考虑使用satis或URL存储库。

try to add 尝试添加

"replace": { "exaibbrplus": "self.version", "typo3-ter/exaibbrplus": "self.version" },

And use only "Metaxos\\\\Exaibbrplus\\\\": "Classes/" in the autoloader. 并在自动装载器中仅使用"Metaxos\\\\Exaibbrplus\\\\": "Classes/"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM