Hi Stefan,
usually you put the bnd parameter into CDATA.
Then you can place comments in a line starting with "#" 
(https://bnd.bndtools.org/md/805-instructions.html 
<https://bnd.bndtools.org/md/805-instructions.html>).
That should work well.
At least it does for bundle-parent 
(https://github.com/apache/sling-parent/blob/cef099f9ebf55a23a99b1b297e42a5e620b1df99/sling-bundle-parent/pom.xml#L66
 
<https://github.com/apache/sling-parent/blob/cef099f9ebf55a23a99b1b297e42a5e620b1df99/sling-bundle-parent/pom.xml#L66>).
The merging is actually a feature of bnd itself.
Konrad

> On 14. Nov 2019, at 16:50, Stefan Seifert <sseif...@pro-vision.de> wrote:
> 
> i was able to find a solution for this problem, although the syntax is a bit 
> fragile and non-intuitive:
> https://github.com/apache/sling-org-apache-sling-caconfig-impl/commit/161ecfc1a1cf6f43e10af76d960283e11b3624fa
> 
> the reason it was ignored completely in my first attempts was that i defined 
> a <configuration> section directly on the plugin element, whereas in the 
> parent pom it was defined on an execution element, which always had higher 
> precedence. moving it down to the same position in the local POM lead to 
> respecting both and merging the configurations.
> 
> and putting comments in between the lines of the import statements worked as 
> well with a) removing the CDATA around it and b) making sure the comment 
> lines also end with "\" (outside the comment). not nice, but works.
> 
> stefan
> 
> 
>> -----Original Message-----
>> From: Julian Sedding [mailto:jsedd...@gmail.com]
>> Sent: Friday, November 1, 2019 12:34 PM
>> To: Sling Developers List
>> Subject: Re: issues switching to bnd maven plugin
>> 
>> Hi Stefan
>> 
>> I agree with your goals, but I think that *should* be possible with
>> the bnd-maven-plugin. Recently I looked into the source of the plugin
>> and the documentation suggests that you need to use either bnd
>> instructions in the pom or a bnd-file (in my understanding that is per
>> maven module). The instructions from a parent pom are then merged
>> using custom logic, see [0]. Maybe reading the implementation of
>> "loadProperties"[1] helps get you unstuck?
>> 
>> Regards
>> Julian
>> 
>> [0] https://github.com/bndtools/bnd/blob/master/maven/bnd-maven-
>> plugin/src/main/java/aQute/bnd/maven/plugin/BndMavenPlugin.java#L138-L150
>> [1] https://github.com/bndtools/bnd/blob/master/maven/bnd-maven-
>> plugin/src/main/java/aQute/bnd/maven/plugin/BndMavenPlugin.java#L479-L488
>> 
>> On Fri, Nov 1, 2019 at 11:49 AM Stefan Seifert <sseif...@pro-vision.de>
>> wrote:
>>> 
>>> additionally to the problems with the bnd baseline maven plugin I'm a bit
>> happy with the way to express project-level bnd instructions with the bnd-
>> maven-plugin, encountered on the branch [1].
>>> 
>>> 1. basically the bnd maven plugin supports both bnd.bnd file and
>> configuration via bnd config parameter in the POM (although the latter is
>> not recommended).
>>> - i know the bnd people have their own special view on POM files and XML
>> file format and try to put everything outside the POM
>>> - i personally prefer to have those instructions all in the POM, e.g.
>> they are then easily detectable also for uploaded libraries with their POM
>> on maven central (and not only in the source jar)
>>> - in general it does not seem to be possible to define a "chain" of parts
>> of bnd configurations in multiple parent poms, each contributing some
>> aspect
>>> - unlike the maven-bundle-plugin there is only a single "bnd"
>> configuration parameter (we are using it in sling-bundle-parent), and it
>> does not seem to possible to define additional instructions in the local
>> POM
>>> - or i did something wrong when trying it
>>> - especially if there are multiple parent POMs involved this seems to be
>> a big restriction for me
>>> 
>>> 2. sometimes a module has some complex instructions which need line-by-
>> line comments to know the reason why they are there
>>> - see [2] for example in caconfig-impl
>>> - this is no longer possible in a bnd file because it breaks the multi
>> line syntax with \ in the line endings
>>> - so i ended up collecting the comments above the instructions [3], but
>> this is not a good replacement
>>> - is there a better solution?
>>> 
>>> 3. i would like to have back an XML-structured way of defining bnd
>> instructions as it was the case in maven-bundle-plugin in bnd-maven-plugin!
>>> - this was easy to document
>>> - and it nicely followed the maven-ways of inheriting and overwriting
>> individual parameters
>>> 
>>> stefan
>>> 
>>> [1] https://github.com/apache/sling-org-apache-sling-caconfig-
>> impl/tree/feature/SLING-8824-parent25
>>> [2] https://github.com/apache/sling-org-apache-sling-caconfig-
>> impl/blob/67fe5f95fe35665c30d95302264941715dcc8b60/pom.xml#L51-L59
>>> [3] https://github.com/apache/sling-org-apache-sling-caconfig-
>> impl/blob/5cf6a823255434c323060cf50ec51400d57499cd/bnd.bnd#L1-L8
>>> 
>>> 
> 

Reply via email to