bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
532 stars 305 forks source link

Extract code to automatically derive data from maven-project #6362

Open laeubi opened 2 weeks ago

laeubi commented 2 weeks ago

Currently if one loads the configuration with aQute.bnd.maven.lib.configuration.BndConfiguration then only the configuration itself is loaded, but actually some implicit configuration later apply (e.g. from the maven project configuration) that is currently only performed by the AbstractBndMavenPlugin.

This extracts this logic from the AbstractBndMavenPlugin into the BndConfiguration class for the following benefits:

laeubi commented 2 weeks ago

The build failure looks like my change in the shared lib is not picked up by the maven build.

laeubi commented 2 weeks ago

@bjhargrave any hint / idea what could be wrong?

bjhargrave commented 2 weeks ago

@bjhargrave any hint / idea what could be wrong?

I don't know.

But this PR seems to be poorly designed from an object oriented perspective. There are 2 things unrelated: reading the configuration from the pom/bnd file and setting some defaults, for bundle building, if they have not been set. I don't see why BndConfiguration should have an instance method for setting defaults since default settings never needed the configuration. That seems a poor place to put default settings for the bnd maven plugin and conflates two things.

laeubi commented 2 weeks ago

There are 2 things unrelated: reading the configuration from the pom/bnd file and setting some defaults, for bundle building, if they have not been set

I think my naming was not really good here, I have now adjusted it to better reflect the meaning. It is actually not any defaults but apply some implicit configuration (and just converted to bnd instructions). Still of course it could also be extracted in a separate class, the main point is that it should not be mangled with the Mojo so it can be used in other context as well.

Sadly this would not resolve the issue that for some reason the invoker tests seem not to "see" the bnd-build jar file with the shared code but some outdated variant :-\

pkriens commented 1 week ago

The problem seems to be that the bnd-baseline-maven-plugin has no dependency to biz.aQute.bnd.maven in its pom.xml. Therefore, the latest biz.aQute.bnd.maven it is not copied to the testing repo. With the wonderful maven logic, it will then likely get it from some random repository, which happens to be the previous version ...

Other bnd plugins might have the same problem although the bnd-maven-plugin seems ok.

However, I'd like to see @bjhargrave 's concerns addressed.

laeubi commented 1 week ago

Build seems running fine now! :+1: