RE: Correct usage of com.liferay.shared.dependencies.*

Olaf Kock, modified 1 Year ago. New Member Post: 1 Join Date: 12/8/23 Recent Posts

Hello

we want to add Excel support to a bundle with POI. I have found a shared library com.liferay.shared.dependencies.poi

I added this to build.grade

compileOnly group: 'com.liferay', name: ' com.liferay.shared.dependencies .poi'

but the packages provided in the library can't be found neither in eclipse nor in the gradle build


​​​​​​​

 

C:\projects\liferay\develop\..... error: package org.apache.poi.ss.usermodel does not exist

import org.apache.poi.ss.usermodel.Workbook;

^

C:\projects\liferay\develop\...... error: cannot find symbol

Workbook wb = null;

^

symbol: class Workbook

location: class RestCommerceService

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

2 errors

What ist the correct way to use this library

br

Chris

7.4
thumbnail
Olaf Kock, modified 1 Year ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

It's less "how to use it" than "what's actually included":

If you look at your license/versions.html file, you'll see that this file includes (file/version)

  • com.liferay.shared.dependencies.poi.jar!commons-collections4.jar    4.4
  • com.liferay.shared.dependencies.poi.jar!poi-ooxml-lite.jar    5.2.2
  • com.liferay.shared.dependencies.poi.jar!poi-ooxml.jar    5.2.2
  • com.liferay.shared.dependencies.poi.jar!poi.jar    5.2.2
  • com.liferay.shared.dependencies.poi.jar!xmlbeans.jar    5.0.3

So, just because it has "poi" in its name, it by far does not include all the libraries that poi offers, and not all of their transitive dependencies. You'll need to bring them in yourself.