Alin Dreghiciu wrote:
Hi,

Does anyone recalls why the following code was added to the
maven-bundle-plugin?

  if (new File(baseDir, "src/main/resources").exists()) {
    header(properties, Analyzer.INCLUDE_RESOURCE, "src/main/resources/");
  }

In my view has two problems:
1. is useless since by the build time all the resources included in
src/main/resources will be copied automatically by maven into target/class
which is in the classpath of bnd so automatically will get into the
resulting bundle
2. is error prone since I can specify my resources in other place in the pom or even add more resource folders. And the point 1 above will do the right
thing anyhow.

Do I miss something?
If not I will make a jira issue to be removed.

Well, perhaps the handling could be improved, but this was here for a reason...although the conditional was added later because someone experienced an issue.

The main issue is that you can use BND to copy resources and it is possible to not use Maven at all for this task, but just have BND do it all.

It is not useless, however. I think the issue is that maven might automatically copy the resources to target/classes, but this does not mean that they will be automatically copied into the bundle by BND. The only way they will be copied automatically is if the happen to fall into a package that was included in <Private-Package> or <Export-Package>, anything not in an included package will not be copied, e.g., META-INF/LICENSE.txt.

Your implication that there might be a way to improve this situation is 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.

-> richard


Alin Dreghiciu

Reply via email to