Setting up for baselining for a non-workspace project

41 views
Skip to first unread message

t...@quarendon.net

unread,
Jun 23, 2017, 9:03:12 AM6/23/17
to bndtools-users
I'm wanting to make use of bnd baselining for an existing java project not originally developed using bnd/bndtools.
At the same time, I want to make the jar I am building a "proper" OSGi bundle.

So I'm trying to manually set up gradle and bnd to build the project, and then do the baselining. 

I have got gradle and the bnd plugin set up to the point that it builds me a bundle, and is reading in the bnd.bnd file and clearly making of of:
Bundle-Version
Bundle-SymbolicName
Export-Package
etc


There are two bits that I'm stuck on though.
First is that I don't seem to be able to "release" from a "non-workspace" build.
The README at https://github.com/bndtools/bnd/blob/master/biz.aQute.bnd.gradle/README.md#gradle-plugin-for-non-workspace-builds seems in to indicate this -- it references "release" tasks under the
  "Workspace builds" 
section but not the 
  "non-workspace builds" 
section.



The other problem I've got is that I don't appear to be able to make it attempt to do any baselining. 

I am using the "plugin" method, so my gradle file is essentially:

   apply plugin: 'biz.aQute.bnd.builder'

   sourceSets {
       main {
           java {
              srcDirs = ['src']
           }
      }
  }

  repositories {
   mavenCentral()
  }
  dependencies {
   compile 'javax.websocket:javax.websocket-api:1.0'
  }


In my bnd.bnd file I have:

-baseline:*
-baselinerepo:Release
-plugin.repo.main: aQute.bnd.repository.maven.provider.MavenBndRepository; releaseUrl=...; snapshotUrl=...; name=Release;

I can't see any evidence of it attempting to perform a baseline when I run
gradle baseline

Removing the "-baselinerepo:", changing it to "-baselinerepo:garbage", using "-releaserepo" instead etc (documentation is inconsistent on whether it's 'baselinerep', 'baselinerepo', or 'baselinerepository'), I can't get it to give me any indication that it's actually performing a baselineing operation.

If I do it the "manual" way, copying the "Create a task of the Baseline type" example in the README, then it does appear to make some attempt to contact a repository and tells me it can't find anything (not surprising, as it's trying to contact maven to find a version of my bundle). It doesn't do this though if I use the "plugin" instead.

The README gives me every indication that using the "apply the plugin" method and indeed I get a "baseline" task that I can run, but I'm obviously needing to supply some extra configuration or something to make it do anything useful?

Any suggestions?
Thanks.


BJ Hargrave

unread,
Jun 23, 2017, 11:15:49 AM6/23/17
to bndtool...@googlegroups.com
For non-workspace build, there is no Bnd release operation since there is no Bnd workspace with Bnd repositories. In this case you are a typical gradle build and need to use the normal gradle process for publishing artifacts. See https://docs.gradle.org/4.0/userguide/artifact_management.html for some information.

If you want to baseline in a non-workspace build, see the Baseline task type: https://github.com/bndtools/bnd/tree/master/biz.aQute.bnd.gradle#create-a-task-of-the-baseline-type. If you apply the BndBuilderPlugin, you will get a baseline task, of type Baseline, created with a default configuration. See https://github.com/bndtools/bnd/blob/master/biz.aQute.bnd.gradle/src/aQute/bnd/gradle/BndBuilderPlugin.groovy#L56-L94. The default configuration tries to locate the prior version of the artifact in the repositories configured in gradle. You may need to specifically configure the baseline artifact to use.

--
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
Reply all
Reply to author
Forward
0 new messages