[bnd-maven-plugin] - Can I disable the plugin in the POM or in the bnd.bnd file?

109 views
Skip to first unread message

Quinn Stevenson

unread,
Mar 29, 2016, 11:08:17 AM3/29/16
to bndtools-users
I'm working on converting the Camel project to use the bnd-maven-plugin for generating the OSGi manifests.

I can consolidate most of the configuration in a top-level bnd.bnd configuration file.  However, I need to disable the bnd-maven-plugin (i.e. generate a plain jar) for a few modules, and it would be easiest if I could do that in the POM or the bnd.bnd file for the specific module.

Is it possible to disable the plugin in for a submodule when it has been enabled in a parent module?

Quinn Stevenson

unread,
Mar 29, 2016, 11:24:19 AM3/29/16
to bndtools-users
I tried the -nomanifest option in the bnd.bnd file, and that does disable the OSGi headers in the manifest.  The problem is it doesn't put anything in the manifest.  I'd like to be able to have the plugin revert back to whatever the maven-jar-plugin would do by default as far as the manifest is concerned.

BJ Hargrave

unread,
Mar 29, 2016, 12:28:33 PM3/29/16
to bndtool...@googlegroups.com
The correct thing would be to use `-nobundles: true` in the project's bnd.bnd file. But looking at source, I see this will cause an NPE in the plugin :-( So I made a PR to fix this: https://github.com/bndtools/bnd/pull/1370.

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

BJ Hargrave

unread,
Mar 29, 2016, 12:30:20 PM3/29/16
to bndtool...@googlegroups.com
The correct thing would be to use `-nobundles: true` in the project's bnd.bnd file. But looking at source, I see this will cause an NPE in the plugin :-( So I made a PR to fix this: https://github.com/bndtools/bnd/pull/1370.

On Tue, Mar 29, 2016 at 11:24 AM Quinn Stevenson <qu...@pronoia-solutions.com> wrote:
--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
BJ

Tim Ward

unread,
Mar 29, 2016, 12:56:05 PM3/29/16
to bndtool...@googlegroups.com
Surely the correct thing to do is not to add the bnd-maven-plugin to the build section of the modules that should not use it? If the plugin is not used then it won't alter the manifest.

Regards,

Tim

BJ Hargrave

unread,
Mar 29, 2016, 12:56:53 PM3/29/16
to bndtool...@googlegroups.com
Don't call me Shirley! :-)

Neil Bartlett

unread,
Mar 29, 2016, 1:10:06 PM3/29/16
to bndtool...@googlegroups.com
Alternatively you could leave out (or create an exception for) the bit of JAR plugin config that is required to use the bnd-maven-plugin. I.e. this stuff:

	<plugin>
	    <groupId>org.apache.maven.plugins</groupId>
	    <artifactId>maven-jar-plugin</artifactId>
	    <configuration>
        	<useDefaultManifestFile>true</useDefaultManifestFile>
	    </configuration>
	</plugin>

*Probably* if you set “useDefaultManifestFile” to false then you get the manifest that is normally generated by the JAR plugin.

NB you may still get SCR XML files, but they are unlikely to be an issue since they will just be ignored.

Neil

Quinn Stevenson

unread,
Apr 1, 2016, 11:33:37 AM4/1/16
to bndtools-users
Thanks for all the input - 

I think I'm going to go with setting useDefaultManifestFile to false when I don't want the OSGi Headers in the manifest for now.  I tested this, and it seems to do what I want - I get the standard headers in the MANIFEST.MF when this is set to false, and I get a all the OSGi Headers when it's set to true.  

I would like to try the -nobundles option - what version of the bnd-maven-plugin will have this PR?  And can you give me an idea when it will be released?

BJ Hargrave

unread,
Apr 1, 2016, 12:58:05 PM4/1/16
to bndtool...@googlegroups.com
The PR will be in 3.2. We hope to release 3.2 by the end of the month.

Quinn Stevenson

unread,
Apr 4, 2016, 3:32:29 PM4/4/16
to bndtools-users
I'd like to try this out, but I can't seem to make maven happy.

I can run the Gradle build for bnd, but the Maven build for the plugin fails - it can't find the bndlib jar.

How can I make the Gradle build publish the JAR's into my local maven repository?

BJ Hargrave

unread,
Apr 4, 2016, 3:58:05 PM4/4/16
to bndtool...@googlegroups.com
See the .travis.yml file for the steps

Reply all
Reply to author
Forward
0 new messages