Foren

[Liferay 7] add non Spring jar file to OSGi Module

Nam Trương, geändert vor 7 Jahren.

[Liferay 7] add non Spring jar file to OSGi Module

New Member Beiträge: 13 Beitrittsdatum: 06.08.15 Neueste Beiträge
I developed this jar to send websocket message by simple servlet project. How to add it in to classpath?
I was read this
https://web.liferay.com/web/user.26526/blog/-/blogs/osgi-module-dependencies
but it not work for me. It seem work for spring library. My jar is not spring project
thumbnail
David H Nebinger, geändert vor 7 Jahren.

RE: [Liferay 7] add non Spring jar file to OSGi Module

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
It definitely does work cuz I use it all the time. Which approach are you trying, what is in your build.gradle file and what instructions are in the bnd.bnd?
Nam Trương, geändert vor 7 Jahren.

RE: [Liferay 7] add non Spring jar file to OSGi Module

New Member Beiträge: 13 Beitrittsdatum: 06.08.15 Neueste Beiträge
Hello,
this is my build.gradle and bnd.bnd file:
dependencies {
	compile project(":modules:bkavCore:bkavCore-api")
	compile project(":modules:bkavCore:bkavCore-service")
	compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
	compile group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
	compile group: "javax.portlet", name: "portlet-api", version: "2.0"
	compile group: "javax.servlet", name: "servlet-api", version: "2.5"
	compile group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
	compile group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
	compile 'com.liferay:com.liferay.portal.configuration.metatype:2.0.0'
	compile 'org.osgi:org.osgi.service.component.annotations:1.3.0'
	compile 'jstl:jstl:1.2'
	compile group: 'com.liferay', name: 'com.liferay.application.list.api', version: '2.0.0'

	compile 'commons-discovery:commons-discovery:20040218.194635'
	compile 'org.apache.axis:axis:1.4'
	compile 'org.eclipse.birt.runtime.3_7_1:javax.wsdl:1.5.1'
	compile 'org.mod4j.org.apache.commons:logging:1.0.4'
	compile 'javax.xml.rpc:javax.xml.rpc-api:1.1.1'
	compile group: 'com.liferay', name: 'com.liferay.journal.api', version: '2.0.0'
	compile group: 'com.liferay', name: 'com.liferay.dynamic.data.mapping.api', version: '2.0.0'
        
         compile files('./src/main/resources/enterprise.jar')
}



Bundle-SymbolicName: websocketTest
Bundle-Version: 1.0.0
thumbnail
David H Nebinger, geändert vor 7 Jahren.

RE: [Liferay 7] add non Spring jar file to OSGi Module

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
Okay, your bnd file does not have any of the entries mentioned in my blog in order to add them to the bundle jar.

Without those key components, you won't be able to build a jar that satisfies the dependencies.
Andrej Haux, geändert vor 4 Jahren.

RE: [Liferay 7] add non Spring jar file to OSGi Module

New Member Beiträge: 3 Beitrittsdatum: 23.05.16 Neueste Beiträge
Hi David,

never tried the gradle way of doing that... we are froced by the companies rules to use maven.

Is there an option to use maven to integrate other libraries (third party / custom) in osgi container?

Would be nice, if you mentioned a maven plugin and maybe other things to check to get that working.

Thanks for your help.
thumbnail
David H Nebinger, geändert vor 4 Jahren.

RE: [Liferay 7] add non Spring jar file to OSGi Module

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
The bnd.bnd changes have nothing to do w/ maven and should work under either build tool.
Andrej Haux, geändert vor 4 Jahren.

RE: [Liferay 7] add non Spring jar file to OSGi Module

New Member Beiträge: 3 Beitrittsdatum: 23.05.16 Neueste Beiträge
That is not true, because some of the gradle plugin is taking care of packing (extracting) the jar's in the deployment artifact...and I thought it is olso writing the bnd file... 

As far as i know there is no plugin in maven which does that automaticaly ....  

I also open a tickte (#3484) at liferay and got the same info - does only work with gradle.

I would realy like to see a project, which fits the following requerements:

- build with maven
- is an osgi jar
- uses third party library like poi or an other (feel free -  I would love to see spring) 
- is build with mvn clean install
- runs in liferay 7 of DXP7 

I tried that 2 weeks long until I switcht to the good old war file, wich is pretty annoing, because it re-deploys after every single change ...