我一直试图在Liferay(6.2)portlet中包含shufflejs。如何在Liferay portlet中使用webjars
我加入了以下依赖我
pom.xml
文件:<dependency> <groupId>org.webjars.bower</groupId> <artifactId>shufflejs</artifactId> <version>4.0.0</version> <scope>compile</scope> </dependency>
- 我已经证实,我的Tomcat服务器上,该
webapps/my-portlet/WEB-INF/lib/shufflejs-4.0.0.jar
存在且,在它的META-INF/resources/webjars/shufflejs/4.0.0/dist/shuffle.js
我在我的
liferay-portlet.xml
文件中包含了以下行:<header-portlet-javascript> /webjars/shufflejs/4.0.0/dist/shuffle.js </header-portlet-javascript>
- 当我与我的浏览器加载我的portlet的页面,我得到的一切,除了我得到
http://localhost:20080/my-portlet/webjars/shufflejs/4.0.0/dist/shuffle.js?browserId=other&minifierType=js&languageId=en_US&b=6210&t=1465296591338
我缺少一个“404 Not Found”错误?
谢谢
我之前试过这个,并且确认我再次尝试过,但没有成功。首先'liferay-portlet.xml'喜欢它来自'webapp'根目录的文档,其他项目('webapp/resources/css/*'和'webapp/resources/js/*'必须被引用开始与'/ resource/...') – Yoshiya
这个评论根本不是真的...... Liferay不需要你的web应用程序中的任何类型的文件夹结构。也许你把这个与JSF约定混淆为'/ resources'?此外,webjars使用servlet 3.0特性,因为lib文件夹中的任何jar都会公开其'META-INF/resources'目录中包含的所有资源。 – Lucas
您的上述信息是正确的,但它没有解决我的问题 - 因为即使在遵循上述信息时我的问题仍然存在。我更新了我的问题,并在下面回答了有关我的问题根源的信息。 – Yoshiya