On 3/23/07, Stuart McCulloch <[EMAIL PROTECTED]> wrote:

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.



With this approach, as I told works fine but bnd will warn as follows:
[WARNING] Instructions for Export-Package  that are never used:
META-INF\..*|!META-INF

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.


I have the "feeling" but I'm waiting for a reaction from Peter
Kriens<[EMAIL PROTECTED]>.
He may have some experience to share with us.
I will rather have a default approach that will not export any package that
do not contain java and the possibility to force the export by using the
Export-Package instruction.

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.


That was the use case I imagined.

> > 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...


I would vote for the plugin options and change.

Alin, do you want to open a JIRA issue for this?

--
Cheers, Stuart



I will.

Alin Dreghiciu

Reply via email to