On 23/03/07, Alin Dreghiciu <[EMAIL PROTECTED]> wrote:
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.
But it is at least clear - the bnd tool could perhaps avoid exporting folders
which don't contain Java classes, but you might want a resource exported
in some situations and wonder why it didn't appear in export-package.
On 3/22/07, Alin Dreghiciu <[EMAIL PROTECTED]> wrote:
>
> 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's extremely useful if you want to embed/inline jarfiles inside your bundle.
> > 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.
I think you just need to iterate through the project resource list, for example:
/*
* I grant license to ASF for inclusion of the following code
* in ASF works, as per the Apache Software License
*/
StringBuilder resourcePaths = new StringBuilder();
for (Iterator i = project.getResources().iterator(); i.hasNext();) {
org.apache.maven.model.Resource resource =
(org.apache.maven.model.Resource)i.next();
if (new File(resource.getDirectory()).exists()) {
String path = resource.getDirectory();
String base = baseDir.getAbsolutePath();
if (path.startsWith(base)) {
path = path.substring(base.length() + 1);
}
if (resourcePaths.length() > 0) {
resourcePaths.append(',');
}
resourcePaths.append(path);
}
}
header(properties, Analyzer.INCLUDE_RESOURCE, resourcePaths);
/*** warning: it hasn't been thoroughly tested! ***/
There should also be a plugin option to turn off this code, just in case ;)
Also should we be preserving the path layout in the bundle, which requires
the PATH=PATH form of Include-Resource, or should we flatten resources?
Perhaps add another plugin option...
Alin, do you want to open a JIRA issue for this?
--
Cheers, Stuart