0
我寫了一個Liferay模塊併成功部署了它。在Gradle中增加了依賴項,Liferay說「未解決的需求:導入包」
然後我說這行build.gradle
的dependencies
部分:
compileOnly group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.3'
運行./gradlew eclipse
我可以使用該庫在Eclipse中沒有問題後。但部署失敗:
12:29:35,454 WARN [fileinstall-/home/nico/liferay/osgi/modules][org_apache_felix_fileinstall:103] Error while starting bundle: file:/home/nico/liferay-dxp-digital-enterprise-7.0-sp3/osgi/modules/de.nico.mymodule-1.0.0.jar
org.osgi.framework.BundleException: Could not resolve module: de.nico.mymodule [1085]_ Unresolved requirement: Import-Package: org.apache.http; version="4.5.3"_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:429)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
我不知道爲什麼它正在尋找org.apache.http
,而不是org.apache.httpcomponents
。
這裏是我的bnd.bnd
:
Bundle-SymbolicName: de.nico.mymodule
Bundle-Version: 1.0.0
Liferay-Require-SchemaVersion: 1.0.0
如何調查研究這個問題呢?
我不想手動下載/添加JAR。
還有一些關於它的官方文檔:https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/adding-third-party-libraries-to-a-module –
@ AndreaDiGiorgi:我嘗試了該頁面描述的內容,並在類型爲org.gradle的對象上得到了'無法爲參數[{group = org.apache.httpcomponents,name = httpclient,version = 4.5.3}]找到方法compileInclude .api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler' –
@Olaf事實上,我沒有「將httpcomponents部署到Liferay」,我正在考慮Gradle將正確的東西包含到我的模塊中。我找到了https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient-osgi,你是否建議我手動下載它和它的許多依賴關係,並將它們全部放到Liferay的deploy /文件夾中? –