karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A. Rothman" <amich...@amichais.net>
Subject Re: Kar mechanic
Date Fri, 23 Aug 2013 10:04:17 GMT

I've given it another shot, this time using 3.0.0-SNAPSHOT of the 
karaf-maven-plugin from the snapshot repo, using the recommended kar 
packaging type. This has gotten me a bit further, but I still came 
across several issues:

10. An out of memory error (PermGen space). Workaround is to set

|MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"|

which is reasonable, but still worth mentioning in case it's caused by a 
memory leak or inefficiency in the plugin which could be fixed so that 
it'll work with out-of-the-box maven.

11. One of the dependency features of the project is cxf-dosgi, whose 
own feature.xml includes a <repository> reference (to cxf) and specifies 
dependency features from it. The plugin doesn't deal with this properly, 
and gives an error that the cxf features can't be found, i.e. it seems 
to ignore the declared respository when resolving features. The 
workaround is to manually add the repository as an explicit dependency 
feature of my own project (alongside the cxf-dosgi feature dependency) 
so that the whole cxf repo is included in the generated kar. The 
expected behavior would be to resolve transitive feature dependencies by 
using the repository tag and including only the necessary features into 
the aggregate kar.

12. The generated feature file specifies the xmlns url with version 
1.2.0, which then cannot be deployed into any previously released Karaf 
version (in my case 2.3.2). The workaround is to add an antrun task 
using the ant replace task and simply replace the 1.2.0 versioned url 
with 1.0.0, and then everything works. Since this plugin has features 
that don't exist in the old plugin, and in my case the old plugin didn't 
work at all, it would be nice if it could generate backwards-compatible 
feature files by either adding a configuration option for specifying the 
target version, or even better, automatically determining the minimal 
compatible version for its generated content and using it (e.g. in this 
case the xml content is fully 1.0.0 compatible, so it could generate a 
1.0.0 url for it, and only generate a 1.2.0 one if it really has 
something that isn't backward compatible in it). But a manual 
configuration option will certainly do and save a bunch of time figuring 
out what's wrong and fiddling with antrun tasks.

13. The project itself contains about a dozen modules/bundles, all of 
which I've added to the pom for generating the kar. However, for some 
reason two of them are not included in either the generated feature.xml 
or the final kar file. Even when running maven with the -X option, 
there's no indication of anything being wrong in the maven output - it 
simply silently ignores those two bundles. Even stranger is the fact 
that originally there were 3 such ignored bundles, but after arbitrarily 
shuffling the order of depends elements in the pom, one of them was 
added, and two are still missing. I have no workaround for this, and no 
idea what's wrong, but the bottom line is that the generated kar is 
incomplete and unusable.

Thanks again for any help and bug fixes which will hopefully follow. I 
hope the workarounds will be useful to others in the meantime :-)


On 08/19/2013 10:35 PM, A. Rothman wrote:
> Other than all the issues detailed below? :-)
> I understand that features and kars are both simple formats, which is 
> nice. But I'd rather not have to create and maintain them all 
> manually... it's quite error prone and time consuming. I was under the 
> impression that the maven plugins (old/new) should be able to create 
> features and kars automatically from the maven dependency info so that 
> everything can be built for offline deployment, but I just can't seem 
> to get them to work.
> What's the current (working) best practices for creating/updating 
> features files, and generating kars from the project feature and 
> dependency features so that it can all be deployed offline?
> Thanks,
> Amichai
> On 08/19/2013 04:20 PM, Jean-Baptiste Onofré wrote:
>> Hi,
>> yes I do (and others ;)).
>> The kar file is just a zip file containing a repository folder. This 
>> folder contains both:
>> - features XML files
>> - all the bundles used in the features, using a Maven structure 
>> (groupId/artifactId/version/artifactId-version.jar)
>> Do you haveissues with offline kar ?
>> Regards
>> JB
>> On 08/19/2013 11:02 AM, A. Rothman wrote:
>>> Does anyone use kars for offline deployment? How do you do so?
>>> On 07/31/2013 09:53 PM, A. Rothman wrote:
>>>> Hi!
>>>> I have a maven project containing several modules and external feature
>>>> dependencies (e.g. cxf-dosgi feature), running in Karaf 2.3.2, which
>>>> will need to be deployed and updated offline (with no internet
>>>> access). Using features and kar files seems to be a perfect fit, but
>>>> I'm having trouble working with them. Here are my attempts and
>>>> results, which I hope someone can help me with.
>>>> At first I tried plugin version 2.3.2, to match the Karaf version I'm
>>>> on (also tried earlier versions while trying to check some of the
>>>> issues, but the result was the same).
>>>> 1. Trying to use the generate-features-xml goal as described in
>>>> http://karaf.apache.org/manual/latest-2.3.x/developers-guide/features-maven-plugin-generate.html

>>>> resulted in an error:
>>>>    [ERROR] Failed to execute goal
>>>> org.apache.karaf.tooling:features-maven-plugin:2.3.2:generate-features-xml

>>>> (generate) on project server: Unable to create features.xml file:
>>>> org.apache.maven.artifact.resolver.ArtifactNotFoundException: Failure
>>>> to find org.eclipse:osgi:jar:3.8.0.v20120529-1548 in
>>>> http://repo.maven.apache.org/maven2 was cached in the local
>>>> repository, resolution will not be reattempted until the update
>>>> interval of central has elapsed or updates are forced
>>>> 2. Running the create-kar goal with a manually created features.xml
>>>> file works, but... the external dependency features seem to be ignored
>>>> - no separate kars are generated from them, and they are not embedded
>>>> in the main project kar (it would be nice to have both of these as
>>>> options).
>>>> 3. I tried manually adding executions to create kar files for the
>>>> external features, but neither a mvn url or a full http url work - it
>>>> appears the featuresFile parameter supports only a local file. So
>>>> what's the proper way to get the external features into kars
>>>> (individual or embedded) for offline deployment?
>>>> Next, I tried my luck with the newer karaf-maven-plugin (currently
>>>> released only in version 3.0.0.RC1),  using docs at
>>>> http://karaf.apache.org/manual/latest/developers-guide/karaf-maven-plugin.html.

>>>> 4. The features-generate-descriptor goal no longer has the
>>>> kernelVersion parameter that the old generate-features-xml had - how
>>>> does it decide which bundles/features are installed by default and
>>>> should not be included as duplicates?
>>>> 5. Setting aggregateFeatures and includeTransitiveDependency to true,
>>>> the external dependency features still seem to be ignored.
>>>> 6. I did hit KARAF-1972 though, which is still unresolved. I'm not
>>>> sure yet if this is just ugly but will work, or if it might actually
>>>> cause trouble when deployed (in my case it included osgi core and
>>>> compendium bundles in the kar).
>>>> 7. It seems the new recommended way of doing things in the new plugin
>>>> is via <packaging>kar</packaging>. However when I tried changing
>>>> packaging from pom to kar I get an error:
>>>> [ERROR] Failed to execute goal
>>>> org.apache.karaf.tooling:karaf-maven-plugin:3.0.0.RC1:features-create-kar

>>>> (default-features-create-kar) on project server: Execution
>>>> default-features-create-kar of goal
>>>> org.apache.karaf.tooling:karaf-maven-plugin:3.0.0.RC1:features-create-kar

>>>> failed: For artifact {com.example.server:server:0.1-SNAPSHOT:kar}: An
>>>> attached artifact must have a different ID than its corresponding main
>>>> artifact. -> [Help 1]
>>>>  (the ID is unique, and I tried changing it too, but still get this
>>>> error. I do have extensions set to true, fwiw.)
>>>> A couple more things that made my attempts a bit less fun:
>>>> 8. Some documentation/website typos I came across:
>>>> http://karaf.apache.org/manual/latest-2.3.x/developers-guide/features-maven-plugin.html

>>>> - the link to create-kar goal in the table at the top of the page is
>>>> messed up.
>>>> http://karaf.apache.org/manual/latest-2.3.x/developers-guide/branding-console.html

>>>> - user variable is shown as $}, which I'm guessing is a typo.
>>>> http://karaf.apache.org/manual/latest-2.3.x/users-guide/provisioning.html

>>>> - last link (to custom build) is broken.
>>>> http://karaf.apache.org/manual/latest-2.3.x/developers-guide/features-maven-plugin-create-kar.html

>>>> - a parameter named {{resourcesDir} is probably a typo. Also the
>>>> default parameter values look fishy (I've seen this elsewhere too).
>>>>     It looks like those and other typos revolve around invalid use of
>>>> curly braces - perhaps you can set up a regex to detect the invalid
>>>> usages and fail the website build accordingly, or at least run a
>>>> one-time grep and fix all of those.
>>>> 9. The docs, examples and configuration parameters and default values
>>>> use feature.xml/features.xml/feature repository interchangeably, which
>>>> is a bit confusing until one reads enough to realize they're all the
>>>> same. It would be clearer to pick a standard xml name and standard
>>>> terminology for it and be consistent everywhere.
>>>> So, can anyone help understand/document/workaround/fix any of these?
>>>> And is there any way to get external features into kars for offline
>>>> deployment? I'm aware of the alternative of building a custom
>>>> pre-installed karaf distribution, though I haven't gone down that path
>>>> yet - I'm still hoping kars are usable since they seem to better fit
>>>> my needs.
>>>> Thanks!
>>>> Amichai

View raw message