twitter-bootstrap 在 Maven 项目中将 Twitter Bootstrap 文件放在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15529184/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 16:40:33  来源:igfitidea点击:

Where to place Twitter Bootstrap Files in a maven project?

maventwitter-bootstrap

提问by AppSensei

I starting out to create something using Twitter Bootstrap & Spring MVC. Can someone tell me where to place the Bootstrap CSS/JS/HTML files in a maven project structure?

我开始使用 Twitter Bootstrap 和 Spring MVC 创建一些东西。有人能告诉我将 Bootstrap CSS/JS/HTML 文件放在 Maven 项目结构中的什么位置吗?

My JSP page shows up fine. But, it's not able to get a hold on the CSS & JS files.

我的 JSP 页面显示正常。但是,它无法控制 CSS 和 JS 文件。

<link href="..resources/css/bootstrap.css" rel="stylesheet">
<link href="../resources/css/bootstrap-responsive.css" rel="stylesheet">

enter image description here

在此处输入图片说明

采纳答案by lotz

The "src/main/resources" folder is for resources that get copied and integrated with the compiled Java code in the resulting artifact (in this case, the WAR under "WEB-INF/classes").

“src/main/resources”文件夹用于在生成的工件中复制并与编译的Java代码集成的资源(在这种情况下,“WEB-INF/classes”下的WAR)。

The "src/main/webapp" folder represents the root of your web content. You'll need to add those web content resources there for them to be available to the JSP(s).

“src/main/webapp”文件夹代表您的网络内容的根目录。您需要在那里添加那些 Web 内容资源,以便 JSP 可以使用它们。

回答by Leesrus

You could use Web Jarsto bring them in as a Maven dependency. This gives you all the benefits of the Maven dependency management. The documentation page details how to use the resources in your app.

您可以使用Web Jars将它们作为 Maven 依赖项引入。这为您提供了 Maven 依赖项管理的所有好处。文档页面详细说明了如何使用应用程序中的资源。