You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Alin Dreghiciu (JIRA)" <ji...@apache.org> on 2007/03/23 09:14:32 UTC

[jira] Created: (FELIX-261) maven-bundle-plugin, Include-Resources directive and maven

maven-bundle-plugin, Include-Resources directive and maven <resources/>
-----------------------------------------------------------------------

                 Key: FELIX-261
                 URL: https://issues.apache.org/jira/browse/FELIX-261
             Project: Felix
          Issue Type: Improvement
          Components: Maven Plugin
            Reporter: Alin Dreghiciu


Currently maven-bundle-plugin handling of resources is hardcoded to the usgae of folder "src/main/resources".
It should instead use the <resources/> folder setting from the pom.

This is a followup of a discussion from felix mail list and bellow is a possible solution from Stuart McCulloch:

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


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-261) maven-bundle-plugin, Include-Resources directive and maven

Posted by "Stuart McCulloch (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stuart McCulloch updated FELIX-261:
-----------------------------------

    Attachment: FELIX-261-20070413.patch

Here's a candidate patch that I derived from the maven resources plugin - it adds the target location of any resources to the bundle using the 'assign' syntax (path1=path2). This means that filtered resources will get stored in the bundle rather than their unfiltered sourcefile (as currently happens).

I have not yet tested it thoroughly, so please let me know if you discover any problems with this patch.

> maven-bundle-plugin, Include-Resources directive and maven <resources/>
> -----------------------------------------------------------------------
>
>                 Key: FELIX-261
>                 URL: https://issues.apache.org/jira/browse/FELIX-261
>             Project: Felix
>          Issue Type: Improvement
>          Components: Maven Bundle Plugin
>            Reporter: Alin Dreghiciu
>         Attachments: FELIX-261-20070413.patch
>
>
> Currently maven-bundle-plugin handling of resources is hardcoded to the usgae of folder "src/main/resources".
> It should instead use the <resources/> folder setting from the pom.
> This is a followup of a discussion from felix mail list and bellow is a possible solution from Stuart McCulloch:
> 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...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.