Below example may help. feature file basically contains the maven dependency and during build time, plugin verifies whether all dependencies satisfied to make the build successful.
If build successful, below pom creates a distr , you can extract and use directly by starting the karaf. replace the variables and provide parent, group id and artifact id information in pom. I am not sure whether this answer helps you, let me know if you need more details. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> ............................... <dependencies> <dependency> <groupId>org.apache.karaf</groupId> <artifactId>apache-karaf</artifactId> <version>${karaf.version}</version> <type>tar.gz</type> <exclusions> <exclusion> <groupId>org.eclipse</groupId> <artifactId>osgi</artifactId> </exclusion> <exclusion> <groupId>org.eclipse</groupId> <artifactId>org.eclipse.osgi</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.cxf.karaf</groupId> <artifactId>apache-cxf</artifactId> <version>${cxf.version}</version> <type>xml</type> <classifier>features</classifier> </dependency> </dependencies> <build> <plugins> <!-- Uncompress the standard Karaf distribution --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack</id> <phase>generate-resources</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.apache.karaf</groupId> <artifactId>apache-karaf</artifactId> <type>tar.gz</type> <outputDirectory>${project.build.directory}/dependencies</outputDirectory> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <configuration> <outputDirectory>${custom-karaf.dir}</outputDirectory> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </configuration> <executions> <execution> <id>copy-resources</id> <phase>process-resources</phase> <goals> <goal>copy-resources</goal> </goals> </execution> </executions> </plugin> <!-- Download features. --> <plugin> <groupId>org.apache.karaf.tooling</groupId> <artifactId>features-maven-plugin</artifactId> <version>2.3.4</version> <executions> <execution> <id>add-features-to-repo</id> <phase>prepare-package</phase> <goals> <goal>add-features-to-repo</goal> </goals> <configuration> <descriptors> <descriptor>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</descriptor> <descriptor>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</descriptor> <descriptor>file:${custom-karaf.system.dir}/spring-3.0.0-features.xml</descriptor> <descriptor>file:${custom-karaf.system.dir}/apache-cxf-2.7.7-features.xml</descriptor> ............................................................................ </descriptors> <features> <feature>standard</feature> <feature>config</feature> <feature>ssh</feature> <feature>kar</feature> <feature>management</feature> <feature>webconsole</feature> <feature>http</feature> <feature>jpa</feature> <feature>transaction</feature> <feature>spring</feature> <feature>spring-dm-web</feature> <feature>spring-orm</feature> <feature>package</feature> <feature>cxf</feature> ............................................ </features> <repository>${custom-karaf.system.dir}</repository> </configuration> </execution> </executions> </plugin> <!-- Build tar.gz artifact. --> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptors> <descriptor>${basedir}/src/main/assemble/karaf-assembly.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>karaf-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> Srikanth Hugar www.gharki.com On Mon, Oct 6, 2014 at 11:24 PM, Marcus Bond <[email protected]> wrote: > Hi, > > I am trying to figure out how to set up the pom for a karaf-assembly in > order to produce a custom distribution. > > I know the names of the features I want installed and started, such as > jetty, jms, cxf, camel etc. however I would like to know how I can > determine the dependencies that are required in the pom in order that the > custom distro will have all required dependencies in the "system" folder. > The environment it will run in has no access to any repositories so will > need to have a complete system folder generated at build time. > > How do we determine the maven dependency that a given feature requires? > > Regards, > Marcus. >
