Grails 构建失败并出现异常

Grails Build Fail With Exception

我在尝试数据库迁移时使用 Grails 3.1.6 我遇到了构建失败。 我用过 grails dbm-generate-gorm-changelog createGame.groovy 这是控制台输出:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'dbmGenerateGormChangelog' not found in root project 'gamereview'.

* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED 

我手动添加的

compile 'org.grails.plugins:database-migration:2.0.0.RC4'

compile 'org.liquibase:liquibase-core:3.3.2'   in 
`build.gradle`  file 

导入有问题吗?需要帮助。

解法:

在 build.gradle 的主要部分添加了 classpath 'org.grails.plugins:database-migration:2.0.0.RC4'。 这解决了问题。

带命令的插件(这包括数据库迁移和休眠以及其他一些)需要在 'main' 依赖块中(与其他插件和常规 jar 依赖项)所以 类 是可用于 运行 应用程序,但由于 Gradle 运行命令,它们还需要位于 buildscript 块中的依赖项块中,例如

buildscript {
   repositories {
      mavenLocal()
      maven { url 'https://repo.grails.org/grails/core' }
   }
   dependencies {
      classpath "org.grails:grails-gradle-plugin:$grailsVersion"
      ...
      classpath 'org.grails.plugins:database-migration:2.0.0.RC4'
   }
}