Bundle-ClassPath and Import-Packages

1,601 views
Skip to first unread message

Jason Tesser

unread,
Nov 18, 2013, 8:35:05 AM11/18/13
to bndtool...@googlegroups.com
BND is not doing what I would expect out of the box. 

I am providing instructions for a Bundle-ClassPath
something like
Bundle-ClassPath', '.,lib/com.springsource.org.aopalliance-1.0.0.jar,....

I am telling the Import-Packages to scan and get my packages
Import-Package', 'somepackages...;*'

The problem is that the packages from the Bundle-ClassPath and making it in the ImportPackages. I know I can simply do this 
!org.springframework.*

But I don't want to have to. Shouldn't BND exclude from Import-Packages packages that are provided by the Bundle-ClassPath?

Peter Kriens

unread,
Nov 18, 2013, 8:39:50 AM11/18/13
to bndtool...@googlegroups.com
On 18 nov. 2013, at 14:35, Jason Tesser <jason...@gmail.com> wrote:
BND is not doing what I would expect out of the box. 
I am providing instructions for a Bundle-ClassPath
something like
Bundle-ClassPath', '.,lib/com.springsource.org.aopalliance-1.0.0.jar,....

I am telling the Import-Packages to scan and get my packages
Import-Package', 'somepackages...;*'
This is wrong ... should be 'Import-Package', 'somepackages.... , *'

The problem is that the packages from the Bundle-ClassPath and making it in the ImportPackages. I know I can simply do this 
!org.springframework.*

But I don't want to have to. Shouldn't BND exclude from Import-Packages packages that are provided by the Bundle-ClassPath?
Yes, so there is something else going wrong. Can you try this out with a standard bnd file? Did you include the library in the JAR?
Can you send the JAR?

Kind regards,

Peter Kriens



--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jason Tesser

unread,
Nov 18, 2013, 8:42:53 AM11/18/13
to bndtool...@googlegroups.com
Yes actually I typoed on the ; I am using the Import-Packages properly 

I am attaching the JAR. 

I am using gradle for this. I have never used BND directly. This is what I am providing to BND 

instruction 'Bundle-Vendor', 'dotcms'
        instruction 'Bundle-Description', 'Spring OSGi Example providing its own Spring for dotcms '
        instruction 'Bundle-DocURL', 'http://www.dotcms.com'
        instruction 'Bundle-Activator', 'com.dotmarketing.osgi.custom.spring.Activator'        
        instruction 'Bundle-ClassPath', '.,lib/com.springsource.org.aopalliance-1.0.0.jar,lib/com.springsource.org.apache.commons.logging-1.1.1.jar,lib/com.springsource.org.apache.log4j-1.2.15.jar,lib/org.springframework.aop-3.1.1.RELEASE.jar,lib/org.springframework.asm-3.1.1.RELEASE.jar,lib/org.springframework.beans-3.1.1.RELEASE.jar,lib/org.springframework.context-3.1.1.RELEASE.jar,lib/org.springframework.context.support-3.1.1.RELEASE.jar,lib/org.springframework.core-3.1.1.RELEASE.jar,lib/org.springframework.expression-3.1.1.RELEASE.jar,lib/org.springframework.web-3.1.1.RELEASE.jar,lib/org.springframework.web.servlet-3.1.1.RELEASE.jar,lib/com.springsource.net.sf.cglib-2.2.0.jar,lib/com.springsource.org.codehaus.jackson-1.4.3.jar,lib/dotcms_log4j.jar'
        instruction 'DynamicImport-Package', '*'
        instruction 'Import-Package', '!org.springframework.*, *;version=0'

com.dotcms.custom.spring-0.1.jar

Jason Tesser

unread,
Nov 18, 2013, 8:45:23 AM11/18/13
to bndtool...@googlegroups.com
Sorry this is what I am providing where the problem exists and here are the instructions

 instruction 'Bundle-Vendor', 'dotcms'
        instruction 'Bundle-Description', 'Spring OSGi Example providing its own Spring for dotcms '
        instruction 'Bundle-DocURL', 'http://www.dotcms.com'
        instruction 'Bundle-Activator', 'com.dotmarketing.osgi.custom.spring.Activator'        
        instruction 'Bundle-ClassPath', '.,lib/com.springsource.org.aopalliance-1.0.0.jar,lib/com.springsource.org.apache.commons.logging-1.1.1.jar,lib/com.springsource.org.apache.log4j-1.2.15.jar,lib/org.springframework.aop-3.1.1.RELEASE.jar,lib/org.springframework.asm-3.1.1.RELEASE.jar,lib/org.springframework.beans-3.1.1.RELEASE.jar,lib/org.springframework.context-3.1.1.RELEASE.jar,lib/org.springframework.context.support-3.1.1.RELEASE.jar,lib/org.springframework.core-3.1.1.RELEASE.jar,lib/org.springframework.expression-3.1.1.RELEASE.jar,lib/org.springframework.web-3.1.1.RELEASE.jar,lib/org.springframework.web.servlet-3.1.1.RELEASE.jar,lib/com.springsource.net.sf.cglib-2.2.0.jar,lib/com.springsource.org.codehaus.jackson-1.4.3.jar,lib/dotcms_log4j.jar'
        instruction 'DynamicImport-Package', '*'


com.dotcms.custom.spring-0.1.jar

Raymond Auge

unread,
Nov 18, 2013, 9:41:36 AM11/18/13
to bndtool...@googlegroups.com
Jason, perhaps you're aware of this, but I thought I would mention it anyway.

All those stock spring jars already contain OSGi bundle headers and so can be deployed as bundles individually.

If you embed all those in every bundle you are creating what you'll suffer from are masses of perm space duplication. None of the spring stack can be shared. This can lead to slow but steady heap costs for your application. I have experience with this because our customers suffer from this already in our application (due to the fact that our current plugins are based on webapps :| ) and we are moving toward OSGi in order to eliminate that very problem.

While I realize your are trying to abstract some of this from developers (as we are) I think as Peter may have mentioned earlier, there are ways to do that without the penalties you will subject yourself too in the long run by not setting things up properly.

A friendly word of caution.

- Ray
Raymond Augé (@rotty3000)
Senior Software Architect
Liferay, Inc. (@Liferay)

Jason Tesser

unread,
Nov 18, 2013, 10:08:34 AM11/18/13
to bndtool...@googlegroups.com
No I get all that. :-)  This is a special case for a different version of Spring. Of course this can all be exported and deployed separately which I also get 

I still need an answer on the Original issue which is the the packages are being added to the Import-Package even though they exist in the Jars in the Bundle-ClassPath

Ferry Huberts

unread,
Nov 18, 2013, 10:16:26 AM11/18/13
to bndtool...@googlegroups.com

On 18/11/13 16:08, Jason Tesser wrote:
No I get all that. :-)  This is a special case for a different version of Spring. Of course this can all be exported and deployed separately which I also get 

I still need an answer on the Original issue which is the the packages are being added to the Import-Package even though they exist in the Jars in the Bundle-ClassPath


the most probable reason is that you use them in your exported packages

-- 
Ferry Huberts
-- 
ir. Ferry Huberts

Pelagic
Bonairepier 28
1339 KH Almere
The Netherlands

E-mail: ferry....@pelagic.nl
Tel: +31.6.54.93.51.31
Internet: http://www.pelagic.nl
KvK: 39095534
-- 
Ferry Huberts

Ferry Huberts

unread,
Nov 18, 2013, 10:23:21 AM11/18/13
to bndtool...@googlegroups.com

On 18/11/13 16:16, Ferry Huberts wrote:

On 18/11/13 16:08, Jason Tesser wrote:
No I get all that. :-)  This is a special case for a different version of Spring. Of course this can all be exported and deployed separately which I also get 

I still need an answer on the Original issue which is the the packages are being added to the Import-Package even though they exist in the Jars in the Bundle-ClassPath


the most probable reason is that you use them in your exported packages



yep, that's it
I just checked you exported packages in the jar you sent, and it says

Export-Package: com.dotmarketing.osgi.custom.spring;version="0.1";uses
 :="com.dotmarketing.osgi,javax.servlet.http,org.osgi.framework,org.sp
 ringframework.context.annotation,org.springframework.stereotype,org.s
 pringframework.ui,org.springframework.web.bind.annotation,org.springf
 ramework.web.servlet,org.springframework.web.servlet.config.annotatio
 n"

there are a _lot_ of uses constraints there. you should probably think hard about whether this is a good design...

Jason Tesser

unread,
Nov 18, 2013, 10:23:12 AM11/18/13
to bndtool...@googlegroups.com
humm I don't have anything in my Export-Package. Meaning I am not providing an Instructions 

In my case what should I provide?

I mean I still think it should not be in the IMport-Packages as the Bundle-ClassPath should take Priority 

Jason Tesser

unread,
Nov 18, 2013, 10:32:38 AM11/18/13
to bndtool...@googlegroups.com
As a test I tried to add  instruction 'Export-Package', '!com.*;-noimport:=true'

BUT that didn't help at all 

Peter Kriens

unread,
Nov 18, 2013, 11:23:11 AM11/18/13
to bndtool...@googlegroups.com
You put the JARs in to the /libs directory but on the Bundle-Classpath you specify lib/ (without the S) ...

Bundle-ClassPath                         .,lib/com.springsource.org.aopalliance-1.0.0.jar,lib/com.springsource.org.apache.commons.logging-1.1.1.jar,lib/com.springsource.org.apache.log4j-1.2.15.jar,lib/org.springframework.aop-3.1.1.RELEASE.jar,lib/org.springframework.asm-3.1.1.RELEASE.jar,lib/org.springframework.beans-3.1.1.RELEASE.jar,lib/org.springframework.context-3.1.1.RELEASE.jar,lib/org.springframework.context.support-3.1.1.RELEASE.jar,lib/org.springframework.core-3.1.1.RELEASE.jar,lib/org.springframework.expression-3.1.1.RELEASE.jar,lib/org.springframework.web-3.1.1.RELEASE.jar,lib/org.springframework.web.servlet-3.1.1.RELEASE.jar,lib/com.springsource.net.sf.cglib-2.2.0.jar,lib/com.springsource.org.codehaus.jackson-1.4.3.jar,lib/dotcms_log4j.jar

bnd print -l com.dotcms.custom.spring-0.1.jar 
[LIST]
META-INF
  MANIFEST.MF
com
com <no contents>
com/dotmarketing
com/dotmarketing <no contents>
com/dotmarketing/osgi
com/dotmarketing/osgi <no contents>
com/dotmarketing/osgi/custom
com/dotmarketing/osgi/custom <no contents>
com/dotmarketing/osgi/custom/spring
  Activator.class
  CustomView.class
  CustomViewResolver.class
  ExampleController.class
libs
  com.springsource.net.sf.cglib-2.2.0.jar
  com.springsource.org.aopalliance-1.0.0.jar
  com.springsource.org.apache.commons.logging-1.1.1.jar
  com.springsource.org.apache.log4j-1.2.15.jar
  com.springsource.org.codehaus.jackson-1.4.3.jar
  dotcms_log4j.jar
  org.springframework.aop-3.1.1.RELEASE.jar
  org.springframework.asm-3.1.1.RELEASE.jar
  org.springframework.beans-3.1.1.RELEASE.jar
  org.springframework.context-3.1.1.RELEASE.jar
  org.springframework.context.support-3.1.1.RELEASE.jar
  org.springframework.core-3.1.1.RELEASE.jar
  org.springframework.expression-3.1.1.RELEASE.jar
  org.springframework.web-3.1.1.RELEASE.jar
  org.springframework.web.servlet-3.1.1.RELEASE.jar
spring
  example-servlet.xml


The reason bnd does not flag this is that in many cases these libraries can be provided by a fragment ... Though a better reason would have been that Bundle-ClassPath sucks and should have never made it into the spec ...

Anyway, this is a REALLY BAD BUNDLE :-) Once you get this to work you will see that bnd will have a warning. The bundle is ok now because you're importing the Spring packages (as you should be). However, once you change the Bundle-ClassPath those packages will be private. So your exported package com.dotmarketing.osgi.custom.spring will have in its public API references to private packages. This is very wrong and will cause lots of grief.

Is there any reason why you are going through these painful and complicated contortions? There seems to be a lot of self inflicted pain here.

Kind regards,

Peter Kriens

Jason Tesser

unread,
Nov 19, 2013, 6:45:56 AM11/19/13
to bndtool...@googlegroups.com
Hi Peter. 

I changed to Bundle-ClassPath to be libs

Still it is the same problem though. I even added this
instruction 'Export-Package', '!com.*;-noimport:=true, *'

Still I get all the Spring classes in the Import-Package

Any more ideas of what I can change?

Peter Kriens

unread,
Nov 19, 2013, 7:44:36 AM11/19/13
to bndtool...@googlegroups.com
Please send the bundle again ... 

Kind regards,

Peter Kriens


Jason Tesser

unread,
Nov 19, 2013, 8:04:11 AM11/19/13
to bndtool...@googlegroups.com
See attached. 

These are the current instructions for BND

       instruction 'Export-Package', '!com.*;-noimport:=true, *'
        instruction 'Bundle-Vendor', 'dotcms'
        instruction 'Bundle-Description', 'Spring OSGi Example providing its own Spring for dotcms '
        instruction 'Bundle-DocURL', 'http://www.dotcms.com'
        instruction 'Bundle-Activator', 'com.dotmarketing.osgi.custom.spring.Activator'        
        instruction 'Bundle-ClassPath', '.,libs/com.springsource.org.aopalliance-1.0.0.jar,libs/com.springsource.org.apache.commons.logging-1.1.1.jar,libs/com.springsource.org.apache.log4j-1.2.15.jar,libs/org.springframework.aop-3.1.1.RELEASE.jar,libs/org.springframework.asm-3.1.1.RELEASE.jar,libs/org.springframework.beans-3.1.1.RELEASE.jar,libs/org.springframework.context-3.1.1.RELEASE.jar,libs/org.springframework.context.support-3.1.1.RELEASE.jar,libs/org.springframework.core-3.1.1.RELEASE.jar,libs/org.springframework.expression-3.1.1.RELEASE.jar,libs/org.springframework.web-3.1.1.RELEASE.jar,libs/org.springframework.web.servlet-3.1.1.RELEASE.jar,libs/com.springsource.net.sf.cglib-2.2.0.jar,libs/com.springsource.org.codehaus.jackson-1.4.3.jar,libs/dotcms_log4j.jar'
        instruction 'DynamicImport-Package', '*'
        instruction 'Import-Package', '*;version=0'


com.dotcms.custom.spring-0.1.jar

Peter Kriens

unread,
Nov 19, 2013, 8:55:52 AM11/19/13
to bndtool...@googlegroups.com
Well, the Export-Package is nonsense, if you use ! it will remove the match from the inputm so the -noimport has no effect whatsoever. In your case you need to use Private-Package: com.dotmarketing.osgi.custom.spring since this package does not need an export. Exporting * is kind of weird and antithesis of modularity. However, the thing I cannot explain now is that with this Export-Package bnd would not have included your classes and would have exported ALL the classes on the Bundle-ClassPath. So what I am seeing in your bundle does not match even remotely what you say your instructions are.

So I extracted your bundle in a directory and created a bnd file to remake it. 

$ ls
META-INF com libs spring

$vi x.bnd
  -classpath: .
  Bundle-Activator: com.dotmarketing.osgi.custom.spring.Activator
  Private-Package: com.dotmarketing.osgi.custom.spring
  -includeresource: spring=spring, libs
  Bundle-SymbolicName: x
  Bundle-ClassPath: ., ${lsr;libs}

$ bnd x.bnd
$ bnd x-0.0.0.jar
Bnd-LastModified                         1384868445566                           
Bundle-Activator                         com.dotmarketing.osgi.custom.spring.Activator
Bundle-ClassPath                         .,com.springsource.net.sf.cglib-2.2.0.jar,com.springsource.org.aopalliance-1.0.0.jar,com.springsource.org.apache.commons.logging-1.1.1.jar,com.springsource.org.apache.log4j-1.2.15.jar,com.springsource.org.codehaus.jackson-1.4.3.jar,dotcms_log4j.jar,org.springframework.aop-3.1.1.RELEASE.jar,org.springframework.asm-3.1.1.RELEASE.jar,org.springframework.beans-3.1.1.RELEASE.jar,org.springframework.context-3.1.1.RELEASE.jar,org.springframework.context.support-3.1.1.RELEASE.jar,org.springframework.core-3.1.1.RELEASE.jar,org.springframework.expression-3.1.1.RELEASE.jar,org.springframework.web-3.1.1.RELEASE.jar,org.springframework.web.servlet-3.1.1.RELEASE.jar
Bundle-ManifestVersion                   2                                       
Bundle-Name                              x                                       
Bundle-SymbolicName                      x                                       
Bundle-Version                           0                                       
Created-By                               1.6.0_43 (Apple Inc.)                   
Import-Package                           bsh,com.caucho.burlap.client,com.caucho.burlap.io,com.caucho.burlap.server,com.caucho.hessian,com.caucho.hessian.client,com.caucho.hessian.io,com.caucho.hessian.server,com.dotmarketing.filters,com.dotmarketing.osgi,com.dotmarketing.util,com.jamonapi,com.lowagie.text,com.lowagie.text.pdf,com.sun.jdmk.comm,com.sun.net.httpserver,com.sun.syndication.feed,com.sun.syndication.feed.atom,com.sun.syndication.feed.rss,com.sun.syndication.io,commonj.timers,commonj.work,edu.emory.mathcs.backport.java.util.concurrent,edu.emory.mathcs.backport.java.util.concurrent.atomic,edu.emory.mathcs.backport.java.util.concurrent.locks,freemarker.cache,freemarker.core,freemarker.ext.jsp,freemarker.ext.servlet,freemarker.template,groovy.lang,javax.activation,javax.annotation,javax.ejb,javax.el,javax.faces.application,javax.faces.component,javax.faces.context,javax.faces.el,javax.faces.event,javax.imageio,javax.imageio.metadata,javax.imageio.stream,javax.inject,javax.interceptor,javax.jms,javax.jws,javax.mail,javax.mail.internet,javax.management,javax.management.modelmbean,javax.management.openmbean,javax.management.remote,javax.naming,javax.persistence.spi,javax.portlet,javax.rmi,javax.servlet,javax.servlet.annotation,javax.servlet.http,javax.servlet.jsp,javax.servlet.jsp.el,javax.servlet.jsp.jstl.core,javax.servlet.jsp.jstl.fmt,javax.servlet.jsp.tagext,javax.sql,javax.swing,javax.swing.border,javax.swing.event,javax.swing.table,javax.swing.text,javax.swing.tree,javax.validation,javax.validation.bootstrap,javax.validation.metadata,javax.xml.bind,javax.xml.bind.annotation,javax.xml.namespace,javax.xml.parsers,javax.xml.rpc,javax.xml.rpc.server,javax.xml.rpc.soap,javax.xml.soap,javax.xml.stream,javax.xml.stream.events,javax.xml.stream.util,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.sax,javax.xml.transform.stax,javax.xml.transform.stream,javax.xml.ws,javax.xml.ws.handler,javax.xml.ws.soap,joptsimple,jxl,jxl.write,net.sf.cglib.asm.util,net.sf.ehcache,net.sf.ehcache.bootstrap,net.sf.ehcache.constructs.blocking,net.sf.ehcache.event,net.sf.ehcache.store,net.sf.jasperreports.engine,net.sf.jasperreports.engine.data,net.sf.jasperreports.engine.design,net.sf.jasperreports.engine.export,net.sf.jasperreports.engine.util,net.sf.jasperreports.engine.xml,org.apache.avalon.framework.logger,org.apache.commons.collections,org.apache.commons.collections.buffer,org.apache.commons.fileupload,org.apache.commons.fileupload.disk,org.apache.commons.fileupload.servlet,org.apache.commons.httpclient,org.apache.commons.httpclient.methods,org.apache.commons.httpclient.params,org.apache.commons.pool,org.apache.commons.pool.impl,org.apache.felix.http.api,org.apache.http,org.apache.http.client,org.apache.http.client.methods,org.apache.http.conn,org.apache.http.conn.scheme,org.apache.http.conn.ssl,org.apache.http.entity,org.apache.http.impl.client,org.apache.http.impl.conn.tsccm,org.apache.http.params,org.apache.http.protocol,org.apache.http.util,org.apache.log,org.apache.poi.hssf.usermodel,org.apache.poi.poifs.filesystem,org.apache.tiles,org.apache.tiles.awareness,org.apache.tiles.context,org.apache.tiles.definition,org.apache.tiles.definition.dao,org.apache.tiles.definition.digester,org.apache.tiles.evaluator,org.apache.tiles.evaluator.el,org.apache.tiles.evaluator.impl,org.apache.tiles.factory,org.apache.tiles.impl,org.apache.tiles.impl.mgmt,org.apache.tiles.jsp.context,org.apache.tiles.locale,org.apache.tiles.locale.impl,org.apache.tiles.preparer,org.apache.tiles.renderer,org.apache.tiles.servlet.context,org.apache.tiles.startup,org.apache.tools.ant,org.apache.tools.ant.types,org.apache.velocity,org.apache.velocity.app,org.apache.velocity.context,org.apache.velocity.exception,org.apache.velocity.runtime,org.apache.velocity.runtime.log,org.apache.velocity.runtime.resource,org.apache.velocity.runtime.resource.loader,org.apache.velocity.tools.generic,org.apache.velocity.tools.view,org.apache.velocity.tools.view.context,org.apache.velocity.tools.view.servlet,org.aspectj.bridge,org.aspectj.lang,org.aspectj.lang.annotation,org.aspectj.lang.reflect,org.aspectj.runtime.internal,org.aspectj.util,org.aspectj.weaver,org.aspectj.weaver.ast,org.aspectj.weaver.bcel,org.aspectj.weaver.internal.tools,org.aspectj.weaver.loadtime,org.aspectj.weaver.patterns,org.aspectj.weaver.reflect,org.aspectj.weaver.tools,org.codehaus.groovy.control,org.codehaus.jackson.map,org.codehaus.jackson.map.type,org.hibernate.validator,org.hibernate.validator.messageinterpolation,org.hibernate.validator.method,org.hibernate.validator.resourceloading,org.joda.time,org.joda.time.format,org.jruby,org.jruby.ast,org.jruby.exceptions,org.jruby.javasupport,org.jruby.runtime,org.jruby.runtime.builtin,org.omg.CORBA,org.osgi.framework,org.osgi.service.http,org.quartz,org.quartz.impl,org.quartz.impl.jdbcjobstore,org.quartz.simpl,org.quartz.spi,org.quartz.utils,org.springframework.instrument,org.springframework.jdbc.datasource,org.springframework.jdbc.support,org.springframework.oxm,org.springframework.transaction,org.springframework.transaction.support,org.w3c.dom,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers
Manifest-Version                         1.0                                     
Private-Package                          com.springsource.net.sf.cglib-2.2.0.jar,com.springsource.org.aopalliance-1.0.0.jar,com.springsource.org.apache.commons.logging-1.1.1.jar,com.springsource.org.apache.log4j-1.2.15.jar,com.springsource.org.codehaus.jackson-1.4.3.jar,com.dotmarketing.osgi.custom.spring,dotcms_log4j.jar,org.springframework.aop-3.1.1.RELEASE.jar,org.springframework.asm-3.1.1.RELEASE.jar,org.springframework.beans-3.1.1.RELEASE.jar,org.springframework.context-3.1.1.RELEASE.jar,org.springframework.context.support-3.1.1.RELEASE.jar,org.springframework.core-3.1.1.RELEASE.jar,org.springframework.expression-3.1.1.RELEASE.jar,org.springframework.web-3.1.1.RELEASE.jar,org.springframework.web.servlet-3.1.1.RELEASE.jar,spring,LICENSE,NOTICE,asm-license.txt,net.sf.cglib.asm,net.sf.cglib.asm.signature,net.sf.cglib.beans,net.sf.cglib.core,net.sf.cglib.proxy,net.sf.cglib.reflect,net.sf.cglib.transform,net.sf.cglib.transform.impl,net.sf.cglib.util,org.aopalliance.aop,org.aopalliance.intercept,org.apache.commons.logging,org.apache.commons.logging.impl,org.apache.log4j,org.apache.log4j.chainsaw,org.apache.log4j.config,org.apache.log4j.helpers,org.apache.log4j.jdbc,org.apache.log4j.jmx,org.apache.log4j.lf5,org.apache.log4j.lf5.config,org.apache.log4j.lf5.util,org.apache.log4j.lf5.viewer,org.apache.log4j.lf5.viewer.categoryexplorer,org.apache.log4j.lf5.viewer.configure,org.apache.log4j.lf5.viewer.images,org.apache.log4j.net,org.apache.log4j.nt,org.apache.log4j.or,org.apache.log4j.or.jms,org.apache.log4j.or.sax,org.apache.log4j.spi,org.apache.log4j.varia,org.apache.log4j.xml,org.codehaus.jackson,org.codehaus.jackson.annotate,org.codehaus.jackson.impl,org.codehaus.jackson.io,org.codehaus.jackson.sym,org.codehaus.jackson.type,org.codehaus.jackson.util,org.apache.log4j.appender,org.springframework.aop,org.springframework.aop.aspectj,org.springframework.aop.aspectj.annotation,org.springframework.aop.aspectj.autoproxy,org.springframework.aop.config,org.springframework.aop.framework,org.springframework.aop.framework.adapter,org.springframework.aop.framework.autoproxy,org.springframework.aop.framework.autoproxy.target,org.springframework.aop.interceptor,org.springframework.aop.scope,org.springframework.aop.support,org.springframework.aop.support.annotation,org.springframework.aop.target,org.springframework.aop.target.dynamic,overview.html,org.springframework.asm,org.springframework.asm.commons,org.springframework.asm.signature,org.springframework.beans,org.springframework.beans.annotation,org.springframework.beans.factory,org.springframework.beans.factory.access,org.springframework.beans.factory.access.el,org.springframework.beans.factory.annotation,org.springframework.beans.factory.config,org.springframework.beans.factory.parsing,org.springframework.beans.factory.serviceloader,org.springframework.beans.factory.support,org.springframework.beans.factory.wiring,org.springframework.beans.factory.xml,org.springframework.beans.propertyeditors,org.springframework.beans.support,org.springframework.cache,org.springframework.cache.annotation,org.springframework.cache.concurrent,org.springframework.cache.config,org.springframework.cache.ehcache,org.springframework.cache.interceptor,org.springframework.cache.support,org.springframework.context,org.springframework.context.access,org.springframework.context.annotation,org.springframework.context.config,org.springframework.context.event,org.springframework.context.expression,org.springframework.context.i18n,org.springframework.context.support,org.springframework.context.weaving,org.springframework.ejb.access,org.springframework.ejb.config,org.springframework.ejb.interceptor,org.springframework.ejb.support,org.springframework.format,org.springframework.format.annotation,org.springframework.format.datetime,org.springframework.format.datetime.joda,org.springframework.format.number,org.springframework.format.support,org.springframework.instrument.classloading,org.springframework.instrument.classloading.glassfish,org.springframework.instrument.classloading.jboss,org.springframework.instrument.classloading.oc4j,org.springframework.instrument.classloading.weblogic,org.springframework.instrument.classloading.websphere,org.springframework.jmx,org.springframework.jmx.access,org.springframework.jmx.export,org.springframework.jmx.export.annotation,org.springframework.jmx.export.assembler,org.springframework.jmx.export.metadata,org.springframework.jmx.export.naming,org.springframework.jmx.export.notification,org.springframework.jmx.support,org.springframework.jndi,org.springframework.jndi.support,org.springframework.remoting,org.springframework.remoting.rmi,org.springframework.remoting.soap,org.springframework.remoting.support,org.springframework.scheduling,org.springframework.scheduling.annotation,org.springframework.scheduling.backportconcurrent,org.springframework.scheduling.concurrent,org.springframework.scheduling.config,org.springframework.scheduling.support,org.springframework.scheduling.timer,org.springframework.scripting,org.springframework.scripting.bsh,org.springframework.scripting.config,org.springframework.scripting.groovy,org.springframework.scripting.jruby,org.springframework.scripting.support,org.springframework.stereotype,org.springframework.ui,org.springframework.ui.context,org.springframework.ui.context.support,org.springframework.validation,org.springframework.validation.annotation,org.springframework.validation.beanvalidation,org.springframework.validation.support,org.springframework.mail,org.springframework.mail.javamail,org.springframework.scheduling.commonj,org.springframework.scheduling.quartz,org.springframework.ui.freemarker,org.springframework.ui.jasperreports,org.springframework.ui.velocity,org.springframework.core,org.springframework.core.annotation,org.springframework.core.convert,org.springframework.core.convert.converter,org.springframework.core.convert.support,org.springframework.core.enums,org.springframework.core.env,org.springframework.core.io,org.springframework.core.io.support,org.springframework.core.serializer,org.springframework.core.serializer.support,org.springframework.core.style,org.springframework.core.task,org.springframework.core.task.support,org.springframework.core.type,org.springframework.core.type.classreading,org.springframework.core.type.filter,org.springframework.util,org.springframework.util.comparator,org.springframework.util.xml,org.springframework.expression,org.springframework.expression.common,org.springframework.expression.spel,org.springframework.expression.spel.ast,org.springframework.expression.spel.generated,org.springframework.expression.spel.standard,org.springframework.expression.spel.support,org.springframework.http,org.springframework.http.client,org.springframework.http.client.support,org.springframework.http.converter,org.springframework.http.converter.feed,org.springframework.http.converter.json,org.springframework.http.converter.xml,org.springframework.http.server,org.springframework.remoting.caucho,org.springframework.remoting.httpinvoker,org.springframework.remoting.jaxrpc,org.springframework.remoting.jaxws,org.springframework.web,org.springframework.web.bind,org.springframework.web.bind.annotation,org.springframework.web.bind.annotation.support,org.springframework.web.bind.support,org.springframework.web.client,org.springframework.web.client.support,org.springframework.web.context,org.springframework.web.context.request,org.springframework.web.context.support,org.springframework.web.filter,org.springframework.web.jsf,org.springframework.web.jsf.el,org.springframework.web.method,org.springframework.web.method.annotation,org.springframework.web.method.support,org.springframework.web.multipart,org.springframework.web.multipart.commons,org.springframework.web.multipart.support,org.springframework.web.util,org.springframework.web.servlet,org.springframework.web.servlet.config,org.springframework.web.servlet.config.annotation,org.springframework.web.servlet.handler,org.springframework.web.servlet.i18n,org.springframework.web.servlet.mvc,org.springframework.web.servlet.mvc.annotation,org.springframework.web.servlet.mvc.condition,org.springframework.web.servlet.mvc.method,org.springframework.web.servlet.mvc.method.annotation,org.springframework.web.servlet.mvc.multiaction,org.springframework.web.servlet.mvc.support,org.springframework.web.servlet.resource,org.springframework.web.servlet.support,org.springframework.web.servlet.tags,org.springframework.web.servlet.tags.form,org.springframework.web.servlet.theme,org.springframework.web.servlet.view,org.springframework.web.servlet.view.document,org.springframework.web.servlet.view.feed,org.springframework.web.servlet.view.freemarker,org.springframework.web.servlet.view.jasperreports,org.springframework.web.servlet.view.json,org.springframework.web.servlet.view.tiles2,org.springframework.web.servlet.view.velocity,org.springframework.web.servlet.view.xml,org.springframework.web.servlet.view.xslt
Require-Capability                       osgi.ee;filter:="(&(&(osgi.ee=JavaSE)(version=1.1))(&(osgi.ee=JavaSE)(version=1.2))(&(osgi.ee=JavaSE)(version=1.3))(&(osgi.ee=JavaSE)(version=1.5))(&(osgi.ee=JavaSE)(version=1.6)))"
Tool                                     Bnd-2.3.0.20131118-174557               

As you can see, it worked perfectly. I now get a shitload of imports (this is expected, since now every Spring module is on your internal classpath so creates references like only Spring can do)

So the problem is somewhere in your setup, the gradle instructions just do not match the bundle you gave me. The instruction you tell me are used should give a very different result. Who wrote this gradle-bnd plugin? I need to see how bnd is parameterized (and someone need to provide a way to see the actual properties that bnd gets). I am afraid they are not doing it right since I am pretty convinced bnd is flawless (well, in this case ... :-)

I can do a code review of the gradle plugin if I know where to look ...

And then again, I am very curious what you're actually trying to do ... the way this bundle is setup goes against anything I believe about modularity ...

Kind regards,

Peter Kriens






<com.dotcms.custom.spring-0.1.jar>

Jason Tesser

unread,
Nov 19, 2013, 9:16:42 AM11/19/13
to bndtool...@googlegroups.com
OK well here is their source 

Also this is my build.gradle file 

I put the libs under src/main/resources so the Jar task will place the libs at the root of the Jar. I know I can specify source sets but even doing that not sure how to make it line up with the bundle classpath. 

Peter Kriens

unread,
Nov 19, 2013, 9:21:01 AM11/19/13
to bndtool...@googlegroups.com

On 19 nov. 2013, at 15:16, Jason Tesser <jason...@gmail.com> wrote:

> OK well here is their source
> https://github.com/gradle/gradle/tree/master/subprojects/osgi
>
> Also this is my build.gradle file
> http://pastebin.com/DFKJPCTy
>
> I put the libs under src/main/resources so the Jar task will place the libs at the root of the Jar. I know I can specify source sets but even doing that not sure how to make it line up with the bundle classpath.

• instruction '-includeresource', 'spring=spring, libs'

That instruction puts all the jars in 'libs' in the root of the bundle. This again does not match your Bundle-ClassPath, which uses 'libs/...'?

Kind regards.

Peter Kriens

Jason Tesser

unread,
Nov 19, 2013, 9:27:18 AM11/19/13
to bndtool...@googlegroups.com
OK so how given my structure http://screencast.com/t/EgtA6ycg3

what instructions should I send. I got confused with your BND instructions and was trying to make it work 

Peter Kriens

unread,
Nov 19, 2013, 9:36:22 AM11/19/13
to bndtool...@googlegroups.com
I think I found the problem, the gradle plugin is at fault. The Gradle plugin is ran against the classes folder but does not include the resources, at least that is what I expect. Since it does not see the resources, it will not see your libs. It also blatantly ignores any errors and warnings which would have informed you about this problem.

There are also some very fishy defaults on the plugin.

Issues were disabled on this project, how do I report these issues?

Kind regards,

Peter Kriens






I guess they use the maven hack to include all of resources 

Peter Kriens

unread,
Nov 19, 2013, 9:38:35 AM11/19/13
to bndtool...@googlegroups.com
The gradle plugin only uses an Analyzer. The Builder class extends Analyzer but is the one that builds the JAR before analysis. So the -includeresource instruction only works for Builders. Some instruction have a dual purpose. E.g. Export-Package for Builder is indicating that certain packages must be included and in the Analyzer it is used create the header.

Kind regards,

Peter Kriens



On 19 nov. 2013, at 15:27, Jason Tesser <jason...@gmail.com> wrote:

Jason Tesser

unread,
Nov 19, 2013, 9:42:40 AM11/19/13
to bndtool...@googlegroups.com
So to report to gradle you go here

or 
to their forums 


I can report but I am not 100% on top of what to report. If you report Peter can you email in this thread the link to the issues? 

Thank you for your help and work here

Ferry Huberts

unread,
Nov 19, 2013, 10:15:26 AM11/19/13
to bndtool...@googlegroups.com

On 19/11/13 15:36, Peter Kriens wrote:
I think I found the problem, the gradle plugin is at fault. The Gradle plugin is ran against the classes folder but does not include the resources, at least that is


I think that is a default of the java plugin of gradle; it doesn't copy resources (from the src tree).
I've seen that as well when working on the gradle support for bndtools


what I expect. Since it does not see the resources, it will not see your libs. It also blatantly ignores any errors and warnings which would have informed you about this problem.

There are also some very fishy defaults on the plugin.

Issues were disabled on this project, how do I report these issues?

Kind regards,

Peter Kriens






I guess they use the maven hack to include all of resources 
On 19 nov. 2013, at 15:27, Jason Tesser <jason...@gmail.com> wrote:

OK so how given my structure http://screencast.com/t/EgtA6ycg3

what instructions should I send. I got confused with your BND instructions and was trying to make it work 

On Tue, Nov 19, 2013 at 9:21 AM, Peter Kriens <peter....@aqute.biz> wrote:
That instruction puts all the jars in 'libs' in the root of the bundle. This again does not match your Bundle-ClassPath, which uses 'libs/...'?



--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


-- 
Ferry Huberts

Peter Kriens

unread,
Nov 19, 2013, 10:34:30 AM11/19/13
to bndtool...@googlegroups.com
I've reported the things I found:


Kind regards,

Peter Kriens
Reply all
Reply to author
Forward
0 new messages