I'm trying to figure out the best way to build a set of features.xml files automatically in a multi-pom project.
I have things *almost* working using karaf-maven-plugin + inputFile filtering, but I'm running into one last issue. Here is how the project is set up: here's the org.opennms.features.topology.api features.xml: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0" name="OpenNMS Topology APIs"> <feature description="OpenNMS Topology APIs" version="1.11.1-SNAPSHOT" name="org.opennms.features.topology.api"> <details>APIs for topology manipulation and display.</details> <bundle>mvn:org.opennms.features.topology/org.opennms.features.topology.api/1.11.1-SNAPSHOT</bundle> <bundle>mvn:com.vaadin/vaadin/6.7.3</bundle> <bundle>wrap:mvn:javax.servlet/servlet-api/2.5</bundle> </feature> </features> In another project (org.opennms.features.topology.app) I have to depend on the API to be able to compile: ---(pom.xml snip!)--- <dependency> <groupId>org.opennms.features.topology</groupId> <artifactId>org.opennms.features.topology.api</artifactId> <version>${project.version}</version> </dependency> ---(pom.xml snip!)--- ...and then I use features-generate-descriptor to create a descriptor: ---(pom.xml snip!)--- <plugin> <groupId>org.apache.karaf.tooling</groupId> <artifactId>karaf-maven-plugin</artifactId> <version>3.0.0-SNAPSHOT</version> <extensions>true</extensions> <executions> <execution> <id>generate</id> <phase>generate-resources</phase> <goals> <goal>features-generate-descriptor</goal> </goals> <configuration> <inputFile>src/main/features/features.xml.in</inputFile> <outputFile>target/features.xml</outputFile> <aggregateFeatures>true</aggregateFeatures> </configuration> </execution> </executions> </plugin> ---(pom.xml snip!)--- I use an inputFile so that org.opennms.features.topology.app can have a "feature" dependency on the API: ---(features.xml.in snip!)--- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0" name="OpenNMS Topology Application"> <feature name="org.opennms.features.topology.app" version="${project.version}" description="OpenNMS Topology Application"> <details>The main Vaadin-based OpenNMS topology application.</details> <feature version="${project.version}">org.opennms.features.topology.api</feature> <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle> </feature> </features> ---(features.xml.in snip!)--- ...but the resultant feature ends up containing both the api "feature" and the mvn: dependency sniffed from the pom. ---(features.xml snip!)--- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0" name="OpenNMS Topology Application"> <feature description="OpenNMS Topology Application" version="1.11.1-SNAPSHOT" name="org.opennms.features.topology.app"> <details>The main Vaadin-based OpenNMS topology application.</details> <feature version="1.11.1-SNAPSHOT">org.opennms.features.topology.api</feature> <bundle>mvn:org.opennms.features.topology/org.opennms.features.topology.app/1.11.1-SNAPSHOT</bundle> <bundle>mvn:org.opennms.features.topology/org.opennms.features.topology.api/1.11.1-SNAPSHOT</bundle> <bundle>mvn:org.ops4j.pax.vaadin/service/0.1.0-SNAPSHOT</bundle> <bundle>wrap:mvn:com.google.gwt/gwt-user/2.3.0</bundle> <bundle>wrap:mvn:net.sf.jung/jung-api/2.0.1</bundle> <bundle>wrap:mvn:net.sourceforge.collections/collections-generic/4.01</bundle> <bundle>wrap:mvn:net.sf.jung/jung-graph-impl/2.0.1</bundle> <bundle>wrap:mvn:net.sf.jung/jung-algorithms/2.0.1</bundle> <bundle>wrap:mvn:colt/colt/1.2.0</bundle> <bundle>wrap:mvn:concurrent/concurrent/1.3.4</bundle> <bundle>wrap:mvn:net.sf.jung/jung-visualization/2.0.1</bundle> </feature> <feature description="OpenNMS Topology APIs" version="1.11.1-SNAPSHOT" name="org.opennms.features.topology.api"> <details>APIs for topology manipulation and display.</details> <bundle>mvn:org.opennms.features.topology/org.opennms.features.topology.api/1.11.1-SNAPSHOT</bundle> <bundle>mvn:com.vaadin/vaadin/6.7.3</bundle> <bundle>wrap:mvn:javax.servlet/servlet-api/2.5</bundle> </feature> </features> ---(features.xml snip!)--- Is there any way to make the karaf-maven-plugin properly sniff dependencies, but ignore the API jar itself that is pulled in from the inputFile version of the features.xml? I've tried various types of scope, depending/not depending on the api bundle, feature, or both. I can't seem to make it realize that it already has that api dependency from the included feature without hand-crafting the entire features.xml, which I'm trying to avoid, since the idea is to handle dependencies in a reasonable way. -- Benjamin Reed The OpenNMS Group http://www.opennms.org/
