Access properties from subprojects' .bnd files in gradle

90 views
Skip to first unread message

Elias Vasylenko

unread,
Sep 18, 2015, 3:19:39 PM9/18/15
to bndtools-users
Hi everyone, I have a pretty straightforward question about the bnd gradle plugin, but I've not been able to figure anything out: Is there any way to extract properties from .bnd files of subprojects as with the 'bnd' and 'bndunprocessed' functions?

BJ Hargrave

unread,
Sep 18, 2015, 8:59:31 PM9/18/15
to bndtool...@googlegroups.com
I'll assume you mean subbundles rather than subprojects which is a gradle term.

The bnd function operates on the bnd Project object. But the bnd.project gradle property holds the bnd Project object. So you can use it to do anything you need.

On Fri, Sep 18, 2015 at 15:19 Elias Vasylenko <eliasva...@gmail.com> wrote:
Hi everyone, I have a pretty straightforward question about the bnd gradle plugin, but I've not been able to figure anything out: Is there any way to extract properties from .bnd files of subprojects as with the 'bnd' and 'bndunprocessed' functions?

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

Elias Vasylenko

unread,
Sep 19, 2015, 7:04:12 AM9/19/15
to bndtools-users
Yup of course, subbundles, thanks. I had already looked through the Project class, but hadn't found anything the first time, so I looked again after you pointed me back in that direction...

For any other people who are apparently bad at finding things: After another search it looks like what I needed was getSubBuilders(), which inherits the same getProperty and getUnprocessedProperty methods as Project, from aQute.bnd.osgi.Processor.

For further reference, here is a simple publication setup using this, for e.g. publishing to maven local or using the artifactory plugin (previously I was using bnd.project.getBuildFiles(true) and pulling the bsn and version from the jars themselves, but this way is more straightforward and flexible):

  publishing {
    publications
{
      project
.bnd.project.getSubBuilders().each {
        builder
-> "maven_${builder.getBsn()}"(MavenPublication) {
          artifactId
= builder.getBsn()
          version
= builder.getProperty('Bundle-Version')

          artifact
new File("${buildDir}/${artifactId}.jar")
       
}
     
}
   
}
 
}

Thanks for the help, BJ

BJ Hargrave

unread,
Sep 21, 2015, 5:09:31 PM9/21/15
to bndtool...@googlegroups.com
I would also like to mention that, for 3.1, Peter is working on adding support to release directly to local and remote m2 repos. So you would be able to configure m2 repos as bnd repos and then the bnd release process will release into them. This will also handle SNAPSHOT repos by tweaking the version to a SNAPSHOT version as part of the process of writing to the repo. 

This is still under development but better maven support is a major theme for bnd/bndtools 3.1.
-- 

BJ



David Daniel

unread,
Sep 22, 2015, 10:33:40 PM9/22/15
to bndtools-users
Do you know when there will be some kind of beta for this functionality

Peter Kriens

unread,
Sep 23, 2015, 4:44:01 AM9/23/15
to bndtool...@googlegroups.com
On 23 sep. 2015, at 04:33, David Daniel <david.da...@gmail.com> wrote:
Do you know when there will be some kind of beta for this functionality
Not clear since we do not have a company behind this effort so it is largely volunteer work. I am trying to start up new work combined with the release of OSGi enRoute + IoT demo. I think it is obvious that this makes me rather short for time. :-(

In the next phase for OSGi enRoute we are trying to get time to make maven a first class citizen in bnd(tools), so this will speed it up. Any success with enRoute will help me spend time on bnd(tools). 

So we know when we get there unless a company is willing to fund the work to speed it up.

Kind regards,

Peter Kriens
Reply all
Reply to author
Forward
0 new messages