Creating an Osgi Package with Dependent Banks Using Gradle

I would like to create several packages that depend on some other (third-party) jars (is this a good practice, is another topic)

I can use gradle to generate a fat jar (which has all the dependent jars) and an osgi manifest

My project Repository layouts in the libs / folder folder After creating the jar, third-party banks are located in the root bank (for example, ibm.jar).

My gradle's task is to use the osgi plugin with some basic osgi instruction, I only specified the export package as my software package manually, but not the other 3 jars

However, when I try to install this package, it shows an error

Error starting file:****.jar (org.osgi.framework.BundleException: Unresol ved constraint in bundle ***** [24]: Unable to resolve 24.0: missi ng requirement [24.0] osgi.wiring.package; (osgi.wiring.package=com.ibm.mq)) org.osgi.framework.BundleException: Unresolved constraint in bundle **** [24]: Unable to resolve 24.0: missing requirement [24.0] osgi.wiring.package; (osgi.wiring.package=com.ibm.mq) at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:382 6) at org.apache.felix.framework.Felix.startBundle(Felix.java:1868) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStart LevelImpl.java:295) at java.lang.Thread.run(Unknown Source) 

Gradle

 task makeJar(type: Jar) { from { 'libs/'} manifest = osgiManifest { classesDir = sourceSets.main.output.classesDir classpath = sourceSets.main.runtimeClasspath instruction 'Export-Package','abc.def' instruction 'Bundle-Vendor', 'ABC' instruction 'Bundle-Activator', 'abc.def.Activator' instruction 'Bundle-ClassPath', '.,*.jar' instruction 'Include-Resource', '@**/*.jar' } } 

I tried with below, but this does not work, it seems gradle problem http://issues.gradle.org/browse/GRADLE-1107

 'Include-Resource', 'libs/' 

I tried to explain how to install them in classpath, but the problem persists

 Bundle-ClassPath: '.,*.jar' 

I see that the package I need (com.ibm.mq) is in the Import-Package: is this correct?

My question is: what should be the right manifest? Can gradle (based on BND) understand dependencies and automatically create a manifest, if so, which one is required?

EDIT: With my gradle installation like this, I get the same error (I checked that the class path is also displayed in the manifest)

 instruction 'Bundle-ClassPath', """.,felix.jar,org.springframework.aop-3.0.5.RELEASE.jar,org.springframework.asm-3.0.5.RELEASE.jar,c3p0-0.9.1.2.jar,com.springsource.net.sf.cglib-2.2.0.jar,org.springframework.context-3.0.5.RELEASE.jar,org.springframework.transaction-3.0.5.RELEASE.jar,com.ibm.mqjms.jar,org.springframework.beans-3.0.5.RELEASE.jar,org.springframework.core-3.0.5.RELEASE.jar,commons-io-1.4.jar,org.springframework.expression-3.0.5.RELEASE.jar,ojdbc14.jar,org.springframework.jdbc-3.0.5.RELEASE.jar,connector.jar,commons-lang-2.4.jar,commons-logging.jar,com.ibm.mq.jar,log4j-1.2.15.jar,org.springframework.web-3.0.5.RELEASE.jar""" 
+4
source share
1 answer

Bnd does not use wild cards for directories or files (for good reason). If you need a wildcard extension for files, use the macro $ {lsa; (dir); (match)}. For more details see Www.aqute.biz/Bnd.

+2
source

Source: https://habr.com/ru/post/1442616/


All Articles