Grails - Database Reverse Engineer plugin not found

不羁的心 提交于 2019-12-23 05:32:29

问题


Environment

Grails 2.4.4
PostgreSQL 9.4
JDK 1.7

I've been trying to get this plugin to work. (I'm still a grails newbie, not to mention programming.)

I tried to do everything I can find out there but still get this untimate error message.

Loading Grails 2.4.4
|Configuring classpath
|Running pre-compiled script
|Script 'DbReverseEngineer' not found, did you mean:
   1) SetVersion
   2) GenerateRestfulController
   3) GenerateViews
   4) GenerateController
   5) DbmGenerateChangelog
Please make a selection or enter Q to quit: 

This is what I have right not in my config files. (I've tried to change a lot of them, such as Hibernate, plugin version etc, but always end up with that message.)

grails.project.dependency.resolver = "maven" 
grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // specify dependency exclusions here; for example, uncomment this to disable ehcache:
        // excludes 'ehcache'
    }
    log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    checksums true // Whether to verify checksums on resolve
    legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility

    repositories {
        inherits true // Whether to inherit repository definitions from plugins

        grailsPlugins()
        grailsHome()
        mavenLocal()
        grailsCentral()
        mavenCentral()
        // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
        mavenRepo "http://repository.codehaus.org"
        //mavenRepo "http://download.java.net/maven/2/"
        mavenRepo "http://repo.grails.org/grails/repo/"
        mavenRepo "http://repository.jboss.com/maven2/"
    }

    dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
        // runtime 'mysql:mysql-connector-java:5.1.29'
        test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
        runtime "org.postgresql:postgresql:9.4-1205-jdbc41"
        compile "org.grails.plugins:db-reverse-engineer:4.0.0"

   }

    plugins {
        // plugins for the build system only
        build ":tomcat:7.0.55"

        // plugins for the compile step
        compile ":scaffolding:2.1.2"
        compile ':cache:1.1.8'
        compile ":asset-pipeline:1.9.9"
        compile ":postgresql-extensions:4.6.1"
        compile ":jquery:1.11.1"
        compile ":joda-time:1.5"
        compile "org.grails.plugins:db-reverse-engineer:4.0.0"

        // plugins needed at runtime but not for compilation
        runtime ":hibernate4:4.3.6.1"// or ":hibernate:3.6.10.18" 
        runtime ":database-migration:1.4.0"
        runtime ":jquery:1.11.1"
        runtime ":db-reverse-engineer:4.0.0"
  }

Thanks in advance.

EDIT 1 So, I changed DbReverseEngineer.groovy under Script folder like this.

mergedConfig.driverClassName = dsConfig.driverClassName ?: 'org.postgresql.Driver'
mergedConfig.password = dsConfig.password ?: ''
mergedConfig.username = dsConfig.username ?: 'postgres'
mergedConfig.url = dsConfig.url ?: 'jdbc:postgresql://localhost:5432/myApp'

And I changed plugin and dependency per Burt's and Emmanuel's advice. And when I run grails db-reverse-engineer command I get this error.

Compilation error: startup failed:
Compile error during compilation with javac.
/home/Documents/Grails_Workspace/myApp/target/work/plugins/cache-1.1.8/src/java/grails/plugin/cache/web/GenericResponseWrapper.java:203: error: method does not override or implement a method from a supertype
    @Override
    ^
/home/Documents/Grails_Workspace/myApp/target/work/plugins/cache-1.1.8/src/java/grails/plugin/cache/web/filter/PageFragmentCachingFilter.java:389: error: cannot find symbol
            contentType = response.getContentType();
                                  ^
  symbol:   method getContentType()
  location: variable response of type HttpServletResponse
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

What are those errors mean and how can I get rid of it? Thanks.


回答1:


You've got the same plugin set up twice:

  1. compile 'org.grails.plugins:db-reverse-engineer:4.0.0'
  2. runtime ':db-reverse-engineer:4.0.0'

According to the plugin's page it should be configured as a compile time dependency:

compile "org.grails.plugins:db-reverse-engineer:4.0.0"

The plugin does have the command that's claimed to be missing. You can see it here. So you may need to refresh the dependencies by running:

grails refresh-dependencies



来源:https://stackoverflow.com/questions/34906579/grails-database-reverse-engineer-plugin-not-found

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