liferayliferay-7.4

Liferay 7.4 GA107: Unresolved requirement: Import-Package: com.ironsoftware.ironpdf_ [Sanitized]


I'm currently working with Liferay 7.4 GA107, and I'm facing a recurring issue whenever I attempt to add a dependency and utilize it within my project. Specifically, I encounter an 'unresolved requirement' error related to import package. This problem persists regardless of the dependency I add. Even after creating a new workspace project and generating a new module within it, the issue remains unresolved. I'm seeking guidance to understand the root cause of this persistent issue.

Error I got

com.liferay.portal.kernel.log.LogSanitizerException: org.osgi.framework.BundleException: Could not resolve module: x.y.z.testing [1626]_ Unresolved requirement: Import-Package: com.ironsoftware.ironpdf_ [Sanitized]

build.gradle file

dependencies {
    compileOnly group: "com.liferay.portal", name: "release.portal.api"

    cssBuilder group: "com.liferay", name: "com.liferay.css.builder", version: "3.1.0"
    
    implementation group: 'com.ironsoftware', name: 'ironpdf', version: '2024.1.1'
}

Any insights or suggestions would be greatly appreciated.


Solution

  • With your build.gradle declaration, you're letting the build system know what your code depends on.

    For that code to be available at runtime, you'll need to deploy your dependencies to the runtime as well.

    Provided

    All you need is to drop the jar in Liferay's deploy/ folder, from where it will be picked up for the runtime system.

    If it has additional dependencies, you'll need to deploy them as well. If it's not an OSGi bundle, you might want to turn it into one (and pull-request that upstream), or use compileInclude, to bundle it with your plugin. Note: You'll need to do the same for all its transitive dependencies that you need at runtime.