Grails Fixture plugin keeps saying build-test-data plugin is not installed

痞子三分冷 提交于 2019-12-02 17:19:43

问题


I have the following dependency declaration in BuildConfig.groovy:

plugins {
    test ':build-test-data:2.2.1'
    test ':fixtures:1.3'
}

I've already run refresh-dependencies on both the terminal, and my IDE (Eclipse) but every time I run the test I get:

grails.plugin.fixtures.exception.FixtureException: build feature is unavailable as build-test-data plugin is not installed
    at grails.plugin.fixtures.builder.FixtureBuilder.assertBuildTestDataPluginInstalledIfNeeded(FixtureBuilder.groovy:135)
    at grails.plugin.fixtures.builder.FixtureBuilder.beans(FixtureBuilder.groovy:104)
    at grails.plugin.fixtures.builder.FixtureBuilder.build(FixtureBuilder.groovy:82)
    at grails.plugin.fixtures.Fixture.build(Fixture.groovy:48)
    at grails.plugin.fixtures.FixtureLoader.build(FixtureLoader.groovy:54)

I checked the FixtureBuilder code, and found the following line:

Holders.pluginManager.hasGrailsPlugin('build-test-data')

I created a separate test to check what this line returns, but no matter what plugin (declared in BuildConfig.groovy) I replace 'build-test-data' with, it always returns false.

How do I fix this?


回答1:


In BuildConfig there are four possible options to configure a plugin:

  • build
  • compile
  • runtime
  • test

Fixture and Build plugins are configured to be use in test you should to change it to runtime to use them in BootStrap when running the app.



来源:https://stackoverflow.com/questions/26112132/grails-fixture-plugin-keeps-saying-build-test-data-plugin-is-not-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!