[ 
https://issues.apache.org/jira/browse/FELIX-1539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753536#action_12753536
 ] 

Stuart McCulloch commented on FELIX-1539:
-----------------------------------------

Sigh, I knew I should have retyped the explanation that disappeared when I had 
to log back in...

Anyway here goes - the Bnd tool used by the maven-bundle-plugin was 
specifically designed
so you could pull classes and resources into a bundle based on a selected set 
of packages.
It therefore does not simply zip up the contents of "target/classes" like the 
maven-jar-plugin.

However, we try to make it as easy as possible for people to migrate projects 
over to bundle
packaging. We turn resource settings into Include-Resource instructions, add 
dependencies
using Embed-Dependency (also updates the Bundle-ClassPath), and scan the local 
source
code to select a default set of packages.

All of which means it is now possible to take most Maven projects, flip the 
packaging from jar
to bundle, and have the same project but with OSGi metadata and added Bnd tool 
verification.

Unfortunately there will always be projects where this won't be be enough - for 
example for
xmlbean, we detect the generated source and generate the appropriate package 
defaults to
pull in the extra classes. But we miss the extra files under 
"schemaorg_apache_xmlbeans"
because there's no correlation between their location and any specified package.

In such situations you need to add instructions (in this case Include-Resource) 
to tell Bnd
about these additional files. There's no other way it can find out about them - 
they're just an
arbitrary path under "target/classes".

We've also had this discussion many times in the past on the Felix lists (ie. 
should we just
grab everything under "target/classes"?) and the consensus from the committers 
has been
that the bundleplugin should primarily behave like Bnd - ie. you could take 
your instructions
and use them with Bnd outside of Maven without too much trouble. In that regard 
we want
to keep using Bnd to generate the final bundle rather than just using jar.

But we also support people who do want to keep using the maven-jar-plugin - 
just use the
"bundle:manifest" goal to generate the manifest, and configure the jarplugin to 
pick it up...

We could maybe make this easier to use (ie. another packaging type or a switch) 
so you
wouldn't need to add the extra build executions - anyone out there willing to 
come up with
a patch or even a suggested process?

In summary I'll mark this issue as resolved, as it is working as designed - you 
just need
an Include-Resource instruction to pull in the extra 
"schemaorg_apache_xmlbeans" files


> generated-classes not included in bundle
> ----------------------------------------
>
>                 Key: FELIX-1539
>                 URL: https://issues.apache.org/jira/browse/FELIX-1539
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven Bundle Plugin
>    Affects Versions: maven-bundle-plugin-2.0.0
>            Reporter: David Jencks
>            Assignee: Stuart McCulloch
>             Fix For: maven-bundle-plugin-2.0.1
>
>
> We have a project using the xmlbeans-maven-plugin to generate some sources.  
> When I change the packaging type to bundle the generated-sources are still 
> compiled into target/generated-classes/xmlbeans but they are not included in 
> the jar.
> An example of such a project is at 
> https://svn.apache.org/repos/asf/geronimo/server/trunk/framework/modules/geronimo-service-builder.
>   The maven-bundle-plugin is configured in an ancestor pom so all you should 
> need to do is change the packaging to bundle and look at the jar.

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

Reply via email to