2017-05-16 46 views
1

我將compile "org.grails:grails-plugin-gsp"添加到在rest-api配置文件下創建的grails 3項目,因此我可以使用API​​文檔返回HTML視圖。我創建了index.gsp中的文件,取得了戰爭,運行應用程序,並得到這個錯誤在Grails 3中顯示GSP rest-api配置文件

ERROR --- [nio-8080-exec-5] .a.c.c.C.[.[.[.[grailsDispatcherServlet] : Servlet.service() for servlet [grailsDispatcherServlet] in context with path [/catalog] threw exception [Could not resolve view with name '/index' in servlet with name 'grailsDispatcherServlet'] with root cause 

javax.servlet.ServletException: Could not resolve view with name '/index' in servlet with name 'grailsDispatcherServlet' 

我認爲錯誤是,普惠制是沒有編譯,因爲在控制檯上,當我運行gradle war我看到

:processResources 
:classes 
:compileGsonViews 
:war 

這是錯誤嗎?我能否以某種方式將編譯gsp任務添加到戰爭任務中? 謝謝!

回答

1

似乎將apply plugin:"org.grails.grails-gsp"添加到build.gradle文件(除了添加依賴關係之外)是有用的。

+0

我打了幾個小時。我需要爲現有的Web模板應用程序添加一些Json視圖,並且在Grails開發模式和命令行-jar模式下,本地一切正常工作。然而,第二個被部署到遠程Linux機器中,所有的gson/json視圖都無法解析。 添加應用程序插件語句(由於我最初創建應用程序的模板而從我的build.gradle中缺少該語句)解決了第一次嘗試的問題。謝謝! – Quad64Bit