RE: osgi bundle jar cannot work in liferay

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

hi 

i am using liferay 7.4, now i want use external jars for oracle agile plm. AgileAPI.jar and pxapi.jar

for that perpose, i create a osgi bundle project and generate osgi bundle jar by myself.

and copied it to <My Project>/src/main/resources/META-INF/lib


than modify my build.gradle

compileInclude files('META-INF/lib/oracle-agile_1.0.0.jar')

but it still cannot work, my code still cannot use it.

i struggle on it over 2 weeks, please help.

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

Can you expand on "cannot work": Please let us know

* how you try using it
​​​​​​​* what's generated? E.g. how does the generated jar's MANIFEST look like, and does it contain the classes you expect?
​​​​​​​* Does "using" the code fail at compile- or at runtime?

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

hi Olaf

thank you for reply.

how i try using it: just like i said.

step 1. i put the osgi bundle jar in folder <My Project>/src/main/resources/META-INF/lib.

step 2. i modified my build.gradle, add 

compileInclude files('META-INF/lib/oracle-agile_1.0.0.jar')

 

what's generated? E.g. how does the generated jar's MANIFEST look like, and does it contain the classes you expect?

you can see my first image, and i am also export the jar via WinRar, both jars in the jar.

 

 Does "using" the code fail at compile- or at runtime?

compile, i use gradle tasks's build, and it failed. the api cannot be resolved from my program.

thumbnail
Jamie Sammons, modified 3 Years ago. Expert Posts: 308 Join Date: 2/13/13 Recent Posts

I think if you use compileInclude files ... you don't want to put your JAR under the src folder. Just put it in a lib folder in the root and do

 

compileInclude files("lib/oracle-agile_1.0.0.jar")

Or listen to whatever Olaf comes up with, that might be your best bet.