2016-01-20 57 views
0

環境的Grails - 數據庫逆向工程插件沒有找到

Grails 2.4.4 
PostgreSQL 9.4 
JDK 1.7 

我一直試圖讓這個插件的工作。 (我還是一個Grails新手,更不用說編程了。)

我試圖盡我所能找到那裏,但仍然得到這個貼心的錯誤消息。

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: 

這就是我沒有權利在我的配置文件。 (我試圖改變他們中的很多,比如Hibernate,插件版本等等,但總是與消息結束了。)提前

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" 
    } 

感謝。

編輯1 於是,我改變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/myApp' 

我改變plugindependency每伯特的和Emmanuel的建議。當我運行grails db-reverse-engineer命令時,我得到這個錯誤。

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. 

這些錯誤是什麼意思,我該如何擺脫它? 謝謝。

+0

嗨蒙蒂做你設法得到它的工作?我也試圖在Rev Gen上添加幾張表格,並在原始問題中更新[編輯1]中的確切錯誤。幫幫我? – alchn

回答

1

你已經得到了相同的插件設置了兩次:

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

根據該插件的頁面應該被配置爲一個編譯時間依賴性:

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

該插件確實有聲稱丟失的命令。你可以看到它here。所以,你可能需要通過運行刷新依賴關係:

grails refresh-dependencies

+1

對於Grails 2,應該在'plugins'塊中編譯:db-reverse-engineer:4.0.0「'。你還應該刪除'dependencies'塊中的依賴項,因爲這是對jar文件的依賴關係,這是一個插件。同時刪除'mavenRepo「http://repository.codehaus.org」'因爲codehaus關閉,並且他們的服務器都沒有運行 –

+0

@Emmanuel Rosa,謝謝。我昨天縮小了範圍,並減少了錯誤。我經歷了一些錯誤,並編輯了我的DbReverseEngineer.groovy。 –

+0

@Burt Beckwith,感謝您的評論。我繼續修理它。我有一些新問題。你能否看到我做得對嗎?我將盡快編輯我的問題。 (哦,我把你的書放在我旁邊,它幫助我完成了我的最後一個項目,謝謝。) –