[英]Inserting Karaf Archive dependencies in features file to create Karaf Archive
I have a Java project using Maven and I'm using Karaf 3.0.4. 我有一个使用Maven的Java项目,并且正在使用Karaf 3.0.4。 I create .kar files using a Maven plugin : 我使用Maven插件创建.kar文件:
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>features-maven-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>create-kar</id>
<goals>
<goal>create-kar<goal>
</goals>
<configuration>
<featuresFile>path/toMy/featureFile.xml</featuresFile>
</configuration>
</execution>
</executions>
In this featureFile.xml , I add the necessary features and bundles dependencies ; 在这个featureFile.xml文件中 ,我添加了必要的功能并捆绑了依赖项; it's working fine : the .kar file is created. 运行正常:.kar文件已创建。
Now, I'd like to add Karaf Archive dependencies in this .xml file but I didn't find a way to do it. 现在,我想在此.xml文件中添加Karaf Archive依赖项 ,但没有找到一种方法。 I was expecting someting like : 我期待着类似的东西:
<feature name="myFeature" version="1.0" install="manual">
<feature>anotherFeature</feature>
<bundle>path/to/aBundle</bundle>
<kar>path/to/aKarafArchive</kar>
</feature>
Do you have an idea ? 你有想法吗 ? Is it possible ? 可能吗 ?
Here is my featureFile.xml 这是我的featureFile.xml
<?xml version="1.0" encoding="UTF-8"?>
<features name="featureFile" xmlns="http://karaf.apache.org/xmlns/features/v1.2.1">
<feature name="aFeature" description="Simple example" version="1.0" install="manual">
<feature>CodeHaus</feature>
<bundle>mvn:org.testng/testng/6.8.8</bundle>
</feature>
<feature name="CodeHaus" description="">
<details>Get CodeHaus bundles</details>
<bundle>mvn:org.codehaus.jackson/jackson-core-asl/1.9.2</bundle>
<bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.2</bundle>
</feature>
</features>
I have 3.0.0.RC1 installed. 我已经安装了3.0.0.RC1。 Check the standard feature file inside 检查里面的标准功能文件
Karaf_root\\system\\org\\apache\\karaf\\features\\standard\\3.0.0.RC1\\standard-3.0.0.RC1-features.xml
For you it should show a different version. 对您来说,它应该显示不同的版本。
Karaf_root\\system\\org\\apache\\karaf\\features\\standard\\${karaf-version}\\standard-${karaf-version}-features.xml
There's an entry here for Karaf Archive feature. 这里有一个关于Karaf存档功能的条目。
<feature resolver="(obr)" description="Provide KAR (KARaf archive) support" version="3.0.0.RC1" name="kar">
<bundle start-level="30">mvn:org.apache.karaf.kar/org.apache.karaf.kar.core/3.0.0.RC1</bundle>
<bundle start-level="30">mvn:org.apache.karaf.kar/org.apache.karaf.kar.command/3.0.0.RC1</bundle>
<bundle start-level="30">mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.kar/3.0.0.RC1</bundle>
</feature>
You can use the same in your feature XML file. 您可以在功能XML文件中使用相同的名称。
Edited* 已编辑*
File system JAR path can be given like below 文件系统JAR路径可以如下所示
<?xml version="1.0" encoding="UTF-8"?>
<features name="MyFeaturesRepo">
<feature name="example-camel-bundle">
<bundle>file:C:/Projects/camel-bundle/target/camel-bundle-1.0-SNAPSHOT.jar</bundle>
<feature version="6.0.0.redhat-024">camel-core</feature>
<feature version="6.0.0.redhat-024">camel-spring-osgi</feature>
<feature version="6.0.0.redhat-024">servicemix-camel</feature>
</feature>
</features>
Source: 资源:
https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/Deploying_into_the_Container/files/DeployFeatures-Create.html https://access.redhat.com/documentation/zh-CN/Red_Hat_JBoss_Fuse/6.0/html/Deploying_into_the_Container/files/DeployFeatures-Create.html
It's from JBoss Fuse, but I think it should work for plain Karaf too. 它来自JBoss Fuse,但我认为它也适用于普通的Karaf。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.