2014-07-26 36 views
2

我搜索计算器,这和发现了一些类似提法,但没有具体的解决方案...Grails的Twitter的引导插件未找到资源

我使用Grails 2.4.2与Twitter的引导:3.2.1插件,但运行的应用程序中得到以下错误:

| Error 2014-07-26 11:51:48,592 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-fixtaglib.css 
| Error 2014-07-26 11:51:48,668 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap.css 
| Error 2014-07-26 11:51:48,725 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-theme.css 
| Error 2014-07-26 11:51:48,778 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-alert.js 
| Error 2014-07-26 11:51:48,807 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-affix.js 
| Error 2014-07-26 11:51:48,837 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-dropdown.js 
| Error 2014-07-26 11:51:48,860 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-modal.js 
| Error 2014-07-26 11:51:48,888 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-popover.js 
| Error 2014-07-26 11:51:48,907 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-scrollspy.js 
| Error 2014-07-26 11:51:48,921 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-tab.js 
| Error 2014-07-26 11:51:48,934 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-tooltip.js 
| Error 2014-07-26 11:51:48,947 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-button.js 
| Error 2014-07-26 11:51:48,959 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-carousel.js 
| Error 2014-07-26 11:51:48,977 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-collapse.js 
| Error 2014-07-26 11:51:48,996 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap-transition.js 
| Error 2014-07-26 11:51:49,012 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /assets/bootstrap.less 

插件的整点是精简资产管线和插件把一切都放在适当的位置。

我有我的BuildConfig.groovy设置拉插件中:

... 
plugins { 
    // plugins for the build system only 
    build ":tomcat:7.0.54" 

    // plugins for the compile step 
    compile ":scaffolding:2.1.2" 
    //compile ':cache:1.1.7' 
    compile ":asset-pipeline:1.8.11" 
    compile ":twitter-bootstrap:3.2.1" 

    // plugins needed at runtime but not for compilation 
    //runtime ":hibernate4:4.3.5.4" // or ":hibernate:3.6.10.16" 
    //runtime ":database-migration:1.4.0" 
    runtime ":jquery:1.11.1" 
    runtime ":resources:1.2.8" 

    // Uncomment these to enable additional asset-pipeline capabilities 
    //compile ":sass-asset-pipeline:1.7.4" 
    compile ":less-asset-pipeline:1.7.0" 
    //compile ":coffee-asset-pipeline:1.7.0" 
    //compile ":handlebars-asset-pipeline:1.3.0.3" 
} 
... 

我有我的GSP正确安装,据我可以告诉:

<%@ page contentType="text/html;charset=UTF-8" %> 
<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <title>Task Master - Tasks</title> 
    <r:require module="jquery"/> 
    <r:require module="bootstrap-js"/> 
    <r:require module="bootstrap"/> 
    <r:layoutResources/> 
</head> 

<body class="container"> 

    <h1>Task Master - Tasks</h1> 
    <r:layoutResources/> 
</body> 
</html> 

我检查,他们不是活得t作为错误状态。我看到有些人通过手动复制资产来破解解决方案,但是这对插件有什么意义?要么我错过了简单的东西,或者插件中存在错误。有任何想法吗?谢谢。

--Ryan

回答

4

在Grails的2.4,资产管道是默认的机制来获得静态资源到客户端。在您的BuildConfig中使用“asset-pipeline”以及“resources”(pre 2.4默认机制)。我不确定,如果这个配置真的是你想要的,并且它甚至可以工作。

仅资产管道有效的配置应该是:

BuildConfig.groovy:

plugins { 
    compile ":asset-pipeline:1.8.11" 
    compile ":twitter-bootstrap:3.2.1" 
    runtime ":jquery:1.11.1" 
} 

的grails-app /视图/布局/ main.gsp:

<%@ page contentType="text/html;charset=UTF-8" %> 
<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <title>Task Master - Tasks</title> 
    <asset:stylesheet href="application.css"/> 
</head> 

<body class="container"> 
    <h1>Task Master - Tasks</h1> 
    <asset:javascript src="application.js"/> 
</body> 
</html> 

grals -app/assets/stylesheets/application.css:

/* 
*= require bootstrap 
*= require_tree . 
*/ 

grals-应用程序/资产/ JavaScript的/ application.js中:

//= require jquery 
//= require bootstrap 
//= require_tree . 

欲了解更多信息,请参阅asset-pipeline plugin的文档以及在twitter-bootstrap插件的文档。

我查了一下,他们是不是在/资产为错误状态

这是真的,因为什么都不会在你的应用程序被复制,而是将资源住在引导的assets directory插入。资产管道插件扫描资产文件夹的每个插件(或出于兼容目的的Web应用程序文件夹)并将其组合,因此在生成的战争中,所有资源都可用。

+0

谢谢马里奥。今晚我会拍这张照片。 – rmcneilly

+0

我试了一下,当我删除“:resources:1.2.8”插件时,错误消失了。他们在一起似乎冲突。我想用Bootstrap弄清楚几件事情,以确保我有一切工作。谢谢。 – rmcneilly

+0

我会继续这个,我删除了buildConfig中的资源插件。groovy,它解决了这个问题 – nbpeth