felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alin Dreghiciu" <adreghi...@gmail.com>
Subject Re: maven-bundle-plugin, Include-Resource and src/main/resources
Date Fri, 23 Mar 2007 08:07:21 GMT
On 3/23/07, Stuart McCulloch <stuart.mcculloch@jayway.net> wrote:
>
> On 23/03/07, Alin Dreghiciu <adreghiciu@gmail.com> 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<Peter.Kriens@aQute.biz>.
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 <adreghiciu@gmail.com> 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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message