我一直試圖在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