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

bnd-resolver-plugin: Add parameter for inline launch description #4476

Closed kwin closed 3 years ago

kwin commented 3 years ago

Currently the Maven plugin only uses external bndrun files (https://github.com/bndtools/bnd/blob/fb81a01eed1a89760d8e32f27b795ecf727cb03f/maven/bnd-resolver-maven-plugin/src/main/java/aQute/bnd/maven/resolver/plugin/ResolverMojo.java#L104). Similar to bnd-maven-plugins parameter bnd (https://github.com/bndtools/bnd/tree/master/maven/bnd-maven-plugin#configuration-parameters) it should support in-pom launch description (which can potentially be inherited).

bjhargrave commented 3 years ago

I don't think pom-based bndrun configuration is a good idea. Unlike building a bundle with bnd-maven-plugin, bndrun configuration is used across many Bnd maven plugins. Resolve uses it, test uses it, run uses it. Since I am unaware of any way in a pom to defined configuration which can be used by several plugins, the separate bndrun file is important. It is also important since the Bndtools UI can edit and resolve bndrun files.

kwin commented 3 years ago

My use case for inheritance is: Checking several bundles if they resolve against a common baseline of bundles. For the common baseline of bundles I currently use

-include ../baseline.bndrun

with baseline.bndrun having

-standalone: ${fileuri;${.}/target/index.xml}
-runfw: org.apache.felix.framework
-runee: JavaSE-1.8

I would love to encapsulate the baseline in a dedicated Maven artifact (containing both the repositoy index.xml, generated with bnd-indexer-maven-plugin, as well as the relevant bndrun configuration referencing it). Any other idea how to reference such a common base line from Maven coordinates?

kwin commented 3 years ago

Also if bnd-resolver-maven-plugin, bnd-run-maven-plugin and bnd-testing-maven-plugin share a common configuration, it would probably make sense to encapsulate all of them in different mojos in the same(!) plugin. That way they could easily share a configuration

bjhargrave commented 3 years ago

Also if bnd-resolver-maven-plugin, bnd-run-maven-plugin and bnd-testing-maven-plugin share a common configuration

They don't share a common maven configuration but can share a common bndrun file.

kwin commented 3 years ago

Using external configuration files for parameterizing runs of Maven plugins is kind of an anti-pattern (due to the limited inheritance)

bjhargrave commented 3 years ago

kind of an anti-pattern

Perhaps, but since Bnd supports much more than just maven and Bnd already has bndrun files, the current approach is used.

My use case for inheritance is

Perhaps @rotty3000 can suggest a better maven configuration story for your use case.

rotty3000 commented 3 years ago

isn't this group of data which you want to resolve against:

-standalone: ${fileuri;${.}/target/index.xml}
-runfw: org.apache.felix.framework
-runee: JavaSE-1.8

represented by a distro?

Futhermore, a distro file is an artifact (jar) which you can publish into a maven repo.

rotty3000 commented 3 years ago

creating a distro is simple:

here's an example I did with Karaf a while back https://github.com/rotty3000/demo-live-coding

kwin commented 3 years ago

@rotty3000 Thanks a lot for that hint. Is there any Maven tooling support for automatically creating distro's? I do have a list of Maven (bundle) dependencies and some additional hardcoded config. Out of this I would like to continuously create distros (preferably with Maven).

bjhargrave commented 3 years ago

Closing.