首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache Karaf功能脱机问题

Apache Karaf功能脱机问题
EN

Stack Overflow用户
提问于 2021-09-15 08:37:54
回答 1查看 85关注 0票数 0

在karaf org.apache.karaf.features.cfg文件中

我已经添加了

featuresRepositories=mvn:org.apache.cxf.karaf/apache-cxf/3.0.8/xml/features

featuresBoot = cxf-jaxws

当karaf使用连接启动时,可以获取并安装cxf功能。

但是没有连接就会失败,如何预装cxf功能?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-18 08:18:27

这可能远不是最好的解决方案(我很想听听更好的解决方案),但你可以使用karaf-feature-archetype创建离线存储库项目,并使用如下配置配置karaf-maven-plugin:

代码语言:javascript
复制
<plugin>
    <groupId>org.apache.karaf.tooling</groupId>
    <artifactId>karaf-maven-plugin</artifactId>

    <configuration>
        <startLevel>50</startLevel>
        <aggregateFeatures>true</aggregateFeatures>
        <checkDependencyChange>true</checkDependencyChange>
        <failOnDependencyChange>false</failOnDependencyChange>
        <logDependencyChanges>true</logDependencyChanges>
        <overwriteChangedDependencies>true</overwriteChangedDependencies>
    </configuration>

    <executions>
        <execution>
            <id>features-add-to-repo</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>features-add-to-repository</goal>
            </goals>
            <configuration>  
                <descriptors>
                    <!-- Feature repository paths -->
                    <descriptor>mvn:groupId/artifactId/version/xml/features</descriptor>
                </descriptors>
                <features>
                    <!-- features and their artifacts + dependencies to add to offline repository-->
                    <feature>featureName</feature>
                    <feature>featureName/version</feature>
                </features>
                <repository>target/offline-repository</repository>
            </configuration>
        </execution>
    </executions>
</plugin>

当使用命令maven clean install打包项目时(在具有在线访问的环境中),它将在目标文件夹下生成离线存储库,您可以将其复制到您的离线环境中,并通过将其添加到文件org.ops4j.pax.url.mvn.cfg中的org.ops4j.pax.url.mvn.defaultRepositories中来告诉karaf使用它,如果它位于主目录中,即file:${user.home}/offline-repository@snapshots@id=local

features.xml本身可以是空的,这只是为了使用karaf-maven-plugin,而不是创建一个实际的特性存储库。

如果您需要创建一个新版本的离线存储库来替换旧版本,请务必小心。如果新版本缺少当前安装到karaf的任何工件,则在尝试删除/卸载它们时可能会导致问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69189739

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档