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 /文件夹中? –