【问题标题】:Grails Database Reverse Engineer Plugin ErrorsGrails 数据库逆向工程师插件错误
【发布时间】:2016-02-02 15:31:26
【问题描述】:

环境

Grails 2.4.4
PostgreSQL 9.4
JDK 1.7

这是我的original question

所以,我就这样改了/myApp/target/work/plugins/db-reverse-engineer-4.0.0/scripts/DbReverseEngineer.groovy

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

我根据 Burt 和 Emmanuel 的建议更改了插件和依赖项。当我运行 grails db-reverse-engineer command 时,我得到了这个错误。

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.

谁能向我解释这些错误的含义以及如何解决它们? 我尝试使用 Grails 3.0.12 并遵循 Grails 3 中的 DB reverse engineer 教程,但我比以往任何时候都迷失了方向。

提前致谢。

编辑

/Grails_Workspace/dbTest/target/work/plugins/db-reverse-engineer-4.0.0/src/groovy/grails/plugin/reveng/Reenigne.groovy: 92: Access to org.hibernate.cfg.Environment#DRIVER is forbidden @ line 92, column 14.
        properties[Environment.DRIVER] = driverClass
.               ^
.    
Access to org.hibernate.cfg.Environment#PASS is forbidden @ line 93, column 14.
        properties[Environment.PASS] = password
.               ^
.    
Access to org.hibernate.cfg.Environment#URL is forbidden @ line 94, column 14.
        properties[Environment.URL] = url
.               ^
.    
Access to org.hibernate.cfg.Environment#USER is forbidden @ line 95, column 14.
        properties[Environment.USER] = username
.               ^
.    
Access to org.hibernate.cfg.Environment#DIALECT is forbidden @ line 97, column 15.
            properties[Environment.DIALECT] = dialect
.                ^
.    
Access to org.hibernate.cfg.Environment#DEFAULT_SCHEMA is forbidden @ line 100, column 15.
            properties[Environment.DEFAULT_SCHEMA] = defaultSchema
.                ^
.    
Access to org.hibernate.cfg.Environment#DEFAULT_CATALOG is forbidden @ line 103, column 15.
            properties[Environment.DEFAULT_CATALOG] = defaultCatalog
                 ^

【问题讨论】:

    标签: grails plugins


    【解决方案1】:

    该错误来自cache 插件,而不是逆向工程插件。如果你不使用它,从BuildConfig.groovy删除它

    【讨论】:

    • 非常感谢您的回答。我删除了它,我得到了不同的错误。它与Reengine.groovy 有关,您能看看我的编辑吗?感谢您的时间和帮助。
    • 尝试删除目标目录,然后运行grails compile,然后看看是否有效
    • 谢谢。我已经删除了目标目录并运行了grails compile,但我仍然遇到同样的错误。这是一个冬眠的东西吗?我什至可以从哪里开始研究?
    【解决方案2】:

    该错误来自缓存插件,将其从 BuildConfig.groovy 中删除并在依赖项中添加以下内容

    compile "net.sf.ehcache:ehcache-core:2.4.6"
    

    【讨论】:

      猜你喜欢
      • 2023-03-24
      • 1970-01-01
      • 2011-07-24
      • 1970-01-01
      • 2011-12-21
      • 2012-06-24
      • 2016-01-20
      • 1970-01-01
      • 2010-10-14
      相关资源
      最近更新 更多