Hi Paul, Not sure I fully understand what you mean, but ignoring Activator from a command perspective is by design.
The plugin scans for any packages part of the bundle (export or private, but not import). In your case, if foo is imported, it’s not scanned as it will register its own commands by its own (it’s to avoid to have some commands register by several bundles). If foo is private to "bar", then, commands will be scanned and added. Regards JB > Le 13 juil. 2020 à 00:42, Paul Spencer <[email protected]> a écrit : > > Karaf 4.2.9 > > I have a bundle "bar" with commands declared with @Service. The bundle has > dependency on "foo" which also containing commands declared using @Service. > Commands from "bar" and "foo" are included in the "Karaf-Commands" of > MANIFEST.MF > > Looking at the karaf-services-maven-plugin, specifically > GenerateServieMetaData.java, I see where Activators not in the output class > path are ignored. There is not such check for services. > > Identification of Bundle Activators defined in dependency are ignored, but > Services are not. Is this a bug in the karaf-services-maven-plugin? > > *** > * MANIFEST.MF > *** > From Karaf-Commands = com.foo.internal,com.bar.internal.commands > > *** > * From the Maven Build > *** > [INFO] --- karaf-services-maven-plugin:4.2.9:service-metadata-generate > (service-metadata-generate) @ ewm-tpm-server --- > [INFO] Ignoring > jar:file:/Users/paul/.m2/repository/com/foo/2.0.0-SNAPSHOT/foo-2.0.0-SNAPSHOT.jar!/com/foo/internal/Activator.class > [INFO] Service com.foo.internal.JobsListCommand > [INFO] Service com.foo.internal.JobResumeCommand > [INFO] Service com.foo.internal.JobPauseCommand > [INFO] Service com.bar.internal.commands.AddCommand > [INFO] Service com.bar.internal.commands.StatusCommand > [INFO] Service com.bar.internal.commands.UpdateCommand > [INFO] Service com.bar.internal.commands.ListCommand > > > *** > * org.apache.karaf.tooling.tracker.GenerateServieMetaData > * > https://github.com/apache/karaf/blob/master/tooling/karaf-services-maven-plugin/src/main/java/org/apache/karaf/tooling/tracker/GenerateServiceMetadata.java > *** > URL classUrl = > clazz.getClassLoader().getResource(clazz.getName().replace('.', '/') + > ".class"); > URL outputDirectoryUrl = new > File(project.getBuild().getOutputDirectory()).toURI().toURL(); > if (classUrl == null || > !classUrl.getPath().startsWith(outputDirectoryUrl.getPath())) { > getLog().info("Ignoring " + classUrl); > continue; > } > ... > > for (Class<?> clazz : services) { > getLog().info("Service " + clazz.getCanonicalName()); > packages.add(clazz.getPackage().getName()); > } > > > Paul Spencer > > >
