2015-04-04 114 views
1

我試圖將我的項目從Grails 2.4移植到3.0。沒什麼奇特的:12個域名,13個控制器和一項服務。 一切工作正常,除了當我嘗試包括腳手架插件。我字面上按照手冊here,但語法必須是錯誤的。添加插件行規定:Grails 3腳手架問題

plugins { 
     … 
     compile ":scaffolding:2.0.0" 
     … 
    } 

導致這個:

BUILD FAILED     

Total time: 1.559 secs  
| Error Error initializing classpath: startup failed: 
build file 'E:\GrailsIdeaProjects\HcaServer\build.gradle': 17: only id(String) method calls allowed in plugins {} script block 

See http://gradle.org/docs/2.3/userguide/plugins.html#sec:plugins_block for information on the plugins {} block 

@ line 17, column 5. 
     compile ":scaffolding:2.0.0" 
    ^

1 error 
(Use --stacktrace to see the full trace) 

有人知道正確的語法,包括Grails的3腳手架插件?

編輯:感謝凱西指出我在正確的方向:腳手架插件實際上已經包含在默認的build.gradle。不管怎樣,我還是讓每一個控制器上像這樣的網頁:

Error: Page Not Found (404) 
Path: /*controllerName*/index 

我一直在使用相同的語法按說明書,宣佈每個控制器上的static scaffold = true。爲什麼我會得到一個404頁面?我在我的視圖文件夾中有index.gsp,error.gsp和notFound.gsp。

回答

3

看起來,文檔尚未針對Grails 3.0進行更新。你build.gradle文件應該有一個dependencies塊,在那裏你可以指定依賴:

dependencies { 
    // ... 
    runtime "org.grails.plugins:scaffolding" 
} 

您還可以通過創建使用Grails 3.0新的應用程序,並檢查了默認build.gradle文件中看到這一點。

0

試試這個,這對我的作品。

dependencies { 
compile "org.grails.plugins:scaffolding" 
} 

我正在使用grails 3.09。