Hi and thank you for your very quick answer. It indeed works much better now!
Kind regards,
Ben

Le 27.12.2015 11:27, Jean-Baptiste Onofré a écrit :
Hi Ben,

it's normal: your pom is not complete, you need to add the following
dependencies:

        <dependency>
            <groupId>org.apache.karaf.features</groupId>
            <artifactId>standard</artifactId>
            <classifier>features</classifier>
            <version>${karaf.version}</version>
            <type>xml</type>
        </dependency>

The kar brings the assembly but not the standard features.

wrap is a standard feature, that's why you have to add the standard
features repository.

Regards
JB

On 12/27/2015 11:18 AM, [email protected] wrote:
Hi everyone,

I am new to Karaf and trying to build a custom karaf distribution. I'm
not very used to features yet (I used to build applications directly
with Felix).

I followed the online documentation and failed to build, then saw this
mailing list post:
http://mail-archives.apache.org/mod_mbox/karaf-user/201504.mbox/%3ccaja7bwnna37n6dj0pyn9qvxyjdjrk7jleawsrcp4kuosk5q...@mail.gmail.com%3E


After reading it, I came up with the POM below. However, I still get a
compilation error, namely "Could not find matching feature for wrap"
(full error stack at the bottom of this mail).

As a first step, what I am trying to do is just to get a minimal Karaf
distribution that I want then to customize. Could someone please help?

Kind regards,

Ben

----
<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>

     <groupId>org.test</groupId>
     <artifactId>test</artifactId>
     <version>1.0.0-SNAPSHOT</version>
     <packaging>karaf-assembly</packaging>

     <dependencies>
         <dependency>
             <!-- scope is compile so all features (there is only one)
are installed into startup.properties and the feature repo itself is not
added in etc/org.apache.karaf.features.cfg file -->
             <groupId>org.apache.karaf.features</groupId>
             <artifactId>framework</artifactId>
             <version>${karaf.version}</version>
             <type>kar</type>
         </dependency>
     </dependencies>

     <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <karaf.version>4.0.3</karaf.version>
     </properties>

     <build>
         <!-- if you want to include resources in the distribution -->
         <resources>
             <resource>
                 <directory>src/main/resources</directory>
                 <filtering>false</filtering>
                 <includes>
                     <include>**/*</include>
                 </includes>
             </resource>
             <resource>
                 <directory>src/main/filtered-resources</directory>
                 <filtering>true</filtering>
                 <includes>
                     <include>**/*</include>
                 </includes>
             </resource>
         </resources>

         <plugins>
<!-- if you want to include resources in the distribution -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-resources-plugin</artifactId>
                 <version>2.6</version>
                 <executions>
                     <execution>
                         <id>process-resources</id>
                         <goals>
                             <goal>resources</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
<!-- karaf-maven-plugin will call both assembly and archive
goals -->
             <plugin>
                 <groupId>org.apache.karaf.tooling</groupId>
                 <artifactId>karaf-maven-plugin</artifactId>
                 <version>${karaf.version}</version>
                 <extensions>true</extensions>
                 <configuration>
                     <!-- Installed Features -->
                     <installedFeatures>
                         <feature>wrapper</feature>
                     </installedFeatures>
                     <!-- Startup Features -->
                     <startupFeatures>

                     </startupFeatures>
                     <!-- Boot Features -->
                     <bootFeatures>
                         <feature>wrap</feature>
                         <feature>aries-blueprint</feature>
                         <feature>shell</feature>
                         <feature>shell-compat</feature>
                         <feature>feature</feature>
                         <feature>jaas</feature>
                         <feature>ssh</feature>
                         <feature>management</feature>
                         <feature>bundle</feature>
                         <feature>config</feature>
                         <feature>deployer</feature>
                         <feature>diagnostic</feature>
                         <feature>feature</feature>
                         <feature>instance</feature>
                         <feature>kar</feature>
                         <feature>log</feature>
                         <feature>package</feature>
                         <feature>service</feature>
                         <feature>system</feature>
                      </bootFeatures>
                 </configuration>
             </plugin>
         </plugins>
     </build>

</project>


----
mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Building test 1.0.0-SNAPSHOT
[INFO]
------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ test ---
[INFO] Deleting /Users/ben/Desktop/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory
/Users/ben/Desktop/src/main/resources
[INFO] skip non existing resourceDirectory
/Users/ben/Desktop/src/main/filtered-resources
[INFO]
[INFO] --- karaf-maven-plugin:4.0.3:assembly (default-assembly) @ test --- [INFO] Using repositories: https://repo.maven.apache.org/maven2@id=central
[INFO] Creating work directory
[INFO] Loading kar and features repositories dependencies
[INFO] Generating karaf assembly: /Users/ben/Desktop/target/assembly
[INFO] Unzipping kars
[INFO] Loading profiles
[INFO] Downloading libraries
[INFO] Loading repositories
[INFO] Resolving features
[INFO] Installing bundle
mvn:org.apache.felix/org.apache.felix.configadmin/1.8.8
[INFO] Installing bundle
mvn:org.apache.felix/org.apache.felix.fileinstall/3.5.0
[INFO] Installing bundle
mvn:org.apache.karaf.features/org.apache.karaf.features.core/4.0.3
[INFO] Installing bundle mvn:org.apache.sshd/sshd-core/0.14.0
[INFO] Installing bundle mvn:org.ops4j.pax.logging/pax-logging-api/1.8.4
[INFO] Installing bundle
mvn:org.ops4j.pax.logging/pax-logging-service/1.8.4
[INFO] Installing bundle mvn:org.ops4j.pax.url/pax-url-aether/2.4.3
[INFO] Installing feature config for framework/4.0.3
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 3.109 s
[INFO] Finished at: 2015-12-27T11:15:20+01:00
[INFO] Final Memory: 19M/208M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.karaf.tooling:karaf-maven-plugin:4.0.3:assembly
(default-assembly) on project test: Unable to build assembly: Could not
find matching feature for wrap -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the
-e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Reply via email to