You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Matteo Rulli <ma...@gmail.com> on 2017/09/05 10:19:33 UTC

Custom file install in Karaf assembly

Hello,
I'm trying to replace the default Felix fileinstall with my custom implementation. 

To do that I built an alternative framework feature and I generated a KAR out of it. 

After that I replaced the 

<dependency>
	<groupId>org.apache.karaf.features</groupId>
	<artifactId>framework</artifactId>
	<type>kar</type>
</dependency>

dependency in my karaf assembly project with the custom KAR (this is exacltly the same as the original one except that it contains my custom fileinstall). Unfortunately when I try to generate the assembly I get this stacktrace:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.1.2:assembly (default-assembly) on project flairkit.assembly: Unable to build assembly
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to build assembly
    at org.apache.karaf.tooling.AssemblyMojo.execute(AssemblyMojo.java:268)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 20 more
Caused by: java.lang.NullPointerException
    at org.apache.karaf.tooling.AssemblyMojo.doExecute(AssemblyMojo.java:463)
    at org.apache.karaf.tooling.AssemblyMojo.execute(AssemblyMojo.java:262)
    ... 22 more

Looking at the AssemblyMojo code, it seams that this is not the right way to achieve what I want to do. Could you suggest the right way to replace fileinstall with a custom implementation in my custom karaf (karaf v. 4.1.2) assembly?

Thank you very much,
Matteo


Re: Custom file install in Karaf assembly

Posted by Guillaume Nodet <gn...@apache.org>.
We have an example in our build.
Here's the framework generation:

https://github.com/apache/karaf/blob/master/assemblies/features/static/pom.xml
It's actually used here:
  https://github.com/apache/karaf/blob/master/demos/profiles/static/pom.xml

A completely different approach may be to blacklist the fileinstall bundle.
Add the following in your plugin config:

<blacklistedBundles>
   <bundle>mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.0</bundle>
</blacklistedBundles>



2017-09-05 12:19 GMT+02:00 Matteo Rulli <ma...@gmail.com>:

> Hello,
> I'm trying to replace the default Felix fileinstall with my custom
> implementation.
>
> To do that I built an alternative framework feature and I generated a KAR
> out of it.
>
> After that I replaced the
>
> <dependency>
> <groupId>org.apache.karaf.features</groupId>
> <artifactId>framework</artifactId>
> <type>kar</type>
> </dependency>
>
> dependency in my karaf assembly project with the custom KAR (this is
> exacltly the same as the original one except that it contains my custom
> fileinstall). Unfortunately when I try to generate the assembly I get this
> stacktrace:
>
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
> goal org.apache.karaf.tooling:karaf-maven-plugin:4.1.2:assembly
> (default-assembly) on project flairkit.assembly: Unable to build assembly
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:213)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:154)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:146)
>     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
> buildProject(LifecycleModuleBuilder.java:117)
>     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.
> buildProject(LifecycleModuleBuilder.java:81)
>     at org.apache.maven.lifecycle.internal.builder.singlethreaded.
> SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>     at org.apache.maven.lifecycle.internal.LifecycleStarter.
> execute(LifecycleStarter.java:128)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
>     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:498)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.
> launchEnhanced(Launcher.java:289)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.
> launch(Launcher.java:229)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.
> mainWithExitCode(Launcher.java:415)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.
> main(Launcher.java:356)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to
> build assembly
>     at org.apache.karaf.tooling.AssemblyMojo.execute(
> AssemblyMojo.java:268)
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(
> DefaultBuildPluginManager.java:134)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
> MojoExecutor.java:208)
>     ... 20 more
> Caused by: java.lang.NullPointerException
>     at org.apache.karaf.tooling.AssemblyMojo.doExecute(
> AssemblyMojo.java:463)
>     at org.apache.karaf.tooling.AssemblyMojo.execute(
> AssemblyMojo.java:262)
>     ... 22 more
>
> Looking at the AssemblyMojo code, it seams that this is not the right way
> to achieve what I want to do. Could you suggest the right way to replace
> fileinstall with a custom implementation in my custom karaf (karaf v.
> 4.1.2) assembly?
>
> Thank you very much,
> Matteo
>
>


-- 
------------------------
Guillaume Nodet