“Unresolved requirement: Import-Package” for a module not in my build.gradle

前端 未结 2 542
失恋的感觉
失恋的感觉 2021-01-24 09:58

I want to use Elasticsearch\'s Client Java class within a Liferay 7 SP4 FP30 module, so I wrote this build.gradle:

dependencies {
    compileOnly gr         


        
2条回答
  •  广开言路
    2021-01-24 10:33

    I'm not familiar with Liferay and gradle, but I've been working with OSGi (apache felix) and maven for a long time. The error message indicates that your bundle uses the package com.liferay.portal.search.elasticsearch.connection, but the runtime environment does not have a bundle that exports that package. The package in question is contained in the first dependency mentioned in your build.gradle, but it's not exported. If you like, you can open the bundle jar and peek into its manifest.mf by downloading it from the maven central repo.

    Since the package is not exported (only com.liferay.portal.search.elasticsearch.settings is), I assume it's a signal that it's not intended for external use. So maybe you should check if there's another way of doing what you want.

    From looking at the Liferay docs for using 3rd party libraries, it seems you are trying to expand the library into your module. Maybe you could try the embedding strategy instead, if you still need to use the .connection package.

提交回复
热议问题