RE: how to use external jar in liferay 7

Scarletake Bwi, modified 3 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts

hi 

i am useing liferay 7.4. and i try use oracle plm api.

i had read osgi-module-dependencies, and put my jars in <LIFERAY_HOME>\tomcat-9.0.56\webapps\ROOT\WEB-INF\shielded-container-lib

but how to use the object in my code? i mean, i have no any information for build.gradle

and i also tried option 4

i modify my build.gradle

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

	cssBuilder group: "com.liferay", name: "com.liferay.css.builder", version: "3.0.2"

	runtime group: 'com.oracle', name: 'agileApi', version: '9.6.3.8'
	runtime group: 'com.oracle', name: 'pxapi', version: '9.6.3.8'
}

and my bnd.bnd

Bundle-Name: VWT-XX
Bundle-SymbolicName: com.vwt
Bundle-Version: 1.0.0
Export-Package: com.vwt.constants
Bundle-ClassPath:\
  .,\
  libs/AgileAPI.jar,\
  libs/pxapi.jar
  
-includeresource:\
  libs/AgileAPI.jar=agileApi-[0-9]*.jar,\
  libs/pxapi.jar=pxapi-[0-9]*.jar

i put my folder "libs" under resource or first layer, both not work.


can anyone help, thank in advance.

thumbnail
Olaf Kock, modified 3 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

Do not put stuff into ROOT/WEB-INF/...

Rather: Check if your dependencies are OSGi bundles - in that case just deploy them to the runtime as well. Otherwise check if you can make them OSGi bundles yourself. Last resort: Try Liferay Workspace's compileInclude directive

Scarletake Bwi, modified 3 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts

hi Olaf

my jars are not osgi bundles, it's oracle provide for oracle plm 

AgileAPI.jar and pxapi.jar

for "make them OSGi bundles yourself", do you mean, modify MANIFEST.MF file and put in deploy folder?

for Try Liferay Workspace's compileInclude directive, i have no idea.

are there any document for detail operate?