How to connect bndtools to maven central ?

408 views
Skip to first unread message

Pierre De Rop

unread,
Jun 7, 2016, 3:13:23 AM6/7/16
to bndtool...@googlegroups.com
Hi,

I wonder how to use maven central from bndtools (not jpm4j for the moment, I tried jpm4j, it works, but for now, I would like to only use maven central).
So, I configured the following plugins (from http://bnd.bndtools.org/plugins/maven.html)

-plugin:\
aQute.bnd.deployer.repository.LocalIndexedRepo; \
name = Local; \
pretty = true; \
local = ${build}/local; \
, \
aQute.bnd.repository.maven.provider.MavenBndRepository; \
index=${.}/central.maven; \
name="Central"; \
, \
aQute.bnd.deployer.repository.wrapper.Plugin; \
        location            = "${build}/cache/wrapper"; \
        reindex = true;
    

then I defined a dependency like this from a sample project:

-buildpath: org.osgi:org.osgi.core:6.0.0

but the project did not build, and I'm having the following error:

org.osgi:org.osgi.core:6.0.0;version=0 Not found in [bnd-cache, Local, MavenBndRepository [localRepo=/home/nxuser/.m2/repository, storage=Central, inited=true]]

Notice that before, I was using the following plugin, which was working except when you had to use a corporate http proxy:

#    aQute.bnd.deployer.repository.aether.AetherRepository; \
# name=Maven Central; \
# cache=${build}/cache;

(since I'm not able to use the aether plugin using an http proxy, I'm trying to use the new aQute.bnd.repository.maven.provider.MavenBndRepository ...)

thanks for your help;

/Pierre

Peter Kriens

unread,
Jun 7, 2016, 4:28:16 AM6/7/16
to bndtool...@googlegroups.com
The -buildpath should always contain the bundle symbolic name if it has one.


In general, you can drop a POM url on the repository in the repositories view, this will add it to the central.maven file.

This plugin is very new and since I do not have access to a corporate proxy the code is only tested against test proxies. I am very interested in your experiences, so far I’ve not had any feedback on these new features.

If you are releasing to a Nexus or Artifactory it is probably wise to use the latest build of bndtools.

I would prefer any issues with the plugin as bnd issues on Github.

Kind regards,

Peter Kriens


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

Pierre De Rop

unread,
Jun 7, 2016, 9:34:45 AM6/7/16
to bndtool...@googlegroups.com
Hi Peter;

Some progress: it works fine using  Bndtools3.2.0.REL-20160517.

I did not know that using the MavenBndRepository you had to also do the same as with the jpm4j plugin and drag the artifacts you want to the "Repositories/Central" view (with jpm4j, you have to drag to the "Buildpath" view).

I used this (as documented in http://bnd.bndtools.org/plugins/maven.html):

-plugin.1.Central: \
aQute.bnd.deployer.repository.wrapper.Plugin; \
location = "${build}/cache/wrapper"; \
reindex = true, \
aQute.bnd.repository.maven.provider.MavenBndRepository; \
index=${.}/central.maven; \
name="Central"
...

and it worked !

Now, I have a question: in the project I'm working on, some people are not Eclipse users (vi/emacs, or intelliJ, etc ...).
And I want them to still use bndtools, but in a "gradle only" mode (that is: use some scripts that can generate the bndtools workspace with the same gradle scripts as you have when you bootstrap a fresh workspace with eclipse etc ...).

The plan is also to use apache Ace OBR, in order to allow people to do semantic versioning with "gradle release" and with the ace OBR server as the baseline repo (using org.apache.ace.bnd.repository.AceObrRepository).

it all works I think, but except that if people need to get some artifacts from maven central (using MavenBndRepository), then it won't be possible for "gradle only" users, since AFAIU, you first have to drag under eclipse the artifacts you want from maven central to the "Repositories/Central" view in order to generate the cnf/central.json file.

So, is there a work around that would allow to force the creation of the json index file ... outside eclispe ?
(I know I'm asking too much 😉)

thanks;

regards
/Pierre


Peter Kriens

unread,
Jun 7, 2016, 9:39:47 AM6/7/16
to bndtool...@googlegroups.com
You can edit the ‘central.maven’ file. Just add GAV’s. This should work seamlessly with drag and drop as well as vi. (If things work as planned a change in vi should trigger an update of the repositories view if you have Eclipse open.)

Sounds like you have to go to a lot of complexity to make everybody happy :-)

Kind regards,

Peter Kriens
Reply all
Reply to author
Forward
0 new messages