Just checked out and if I use: <Export-Package> !META-INF.*, * </Export-Package>
I will get what I want: META-INF/spring not exported but included in the bundle due to, I suppose, Include-resource. It is anyhow annoying that I will have exclude via the export-package directive the content of resources folder. I have to run now but I will come back on the subject. Alin Dreghiciu On 3/22/07, Alin Dreghiciu <[EMAIL PROTECTED]> wrote:
On 3/22/07, Richard S. Hall <[EMAIL PROTECTED]> wrote: > > Alin Dreghiciu wrote: > > Hi, > > > > Does anyone recalls why the following code was added to the > > maven-bundle-plugin? > > > > if (new File(baseDir, "src/main/resources").exists()) { > > header(properties, Analyzer.INCLUDE_RESOURCE, > "src/main/resources/"); > > } > > > > In my view has two problems: > > 1. is useless since by the build time all the resources included in > > src/main/resources will be copied automatically by maven into > > target/class > > which is in the classpath of bnd so automatically will get into the > > resulting bundle > > 2. is error prone since I can specify my resources in other place in > > the pom > > or even add more resource folders. And the point 1 above will do the > > right > > thing anyhow. > > > > Do I miss something? > > If not I will make a jira issue to be removed. > > Well, perhaps the handling could be improved, but this was here for a > reason...although the conditional was added later because someone > experienced an issue. Felix is right. if the folder does not exist BND fails. The main issue is that you can use BND to copy resources and it is > possible to not use Maven at all for this task, but just have BND do it > all. I do not have any problem with the Include-Resource directive from BND. That has it's role and I can imagine is usefull. It is not useless, however. I think the issue is that maven might > automatically copy the resources to target/classes, but this does not > mean that they will be automatically copied into the bundle by BND. The > only way they will be copied automatically is if the happen to fall into > > a package that was included in <Private-Package> or <Export-Package>, > anything not in an included package will not be copied, e.g., > META-INF/LICENSE.txt. Usual usage is that by the end of the Export-package you will get a * that will most of the time match the resources. I have to check just one thing more: If the Include-Resource has any impact on how bnd calculates the export/import packages. If it will not take in consideration the Include-Resource directive in this calculation then it is an useful feature. But then we have to find out how to deal with the fact that the files from resources get copied to the classes folder anyway so bnd is including them in the export/import calculation and the jar. Maybe by adding the resource content to private-package? Real life example: spring-osgi style 1. I must have the configuration xml's into META-INF/spring folder. 2. I keep those files into src/main/resources/META-INF/spring so Maven automatically copy them to target/classes so also into the bundle. 3. export-package = * => Include-Package useless for this case 4. everything works fine but I do get in the manifest export-package an entry as: META-INF/spring I'm wondering about: What's the use of this export/import? Will the framework be able to substitute my *.xml files? How? since there will be quite an conflict related to the fact that the exported package has no name space; is just META-INF/spring and all spring bundles will have it. What then about those files that resides into the root folder? Your implication that there might be a way to improve this situation is > probably correct, but I don't know what the solution is. At a minimum, > perhaps the plugin should automatically append every resource location > specified in the POM file to the <Include-Resource> directive by > default...if that is possible. Should be :) -> richard > > > > > Alin Dreghiciu > > >