使用Karaf features-maven-plugin构建具有CXF依赖的存储库会导致无限循环。

huangapple go评论59阅读模式
英文:

Building repo with Karaf features-maven-plugin with CXF dependency causes infinite loop

问题

使用Karaf features-maven-plugin构建带有CXF依赖项的仓库会导致无限循环。

我正在使用org.apache.karaf.tooling/features-maven-plugin的版本2.3.12。

看起来这是在CXF版本3.2.x添加cxf-core和cxf-commands之间的循环依赖关系时开始发生的。

它会输出数百个这样的信息,然后抛出堆栈溢出异常:

[INFO] 添加功能的内容: cxf-core/3.2.14
[INFO] 添加功能的内容: cxf-commands/3.2.14
[INFO] 添加功能的内容: cxf-core/3.2.14
[INFO] 添加功能的内容: cxf-commands/3.2.14

这是我的pom文件中的插件部分:

<groupId>org.apache.karaf.tooling</groupId>
<artifactId>features-maven-plugin</artifactId>
<version>2.4.4</version>
<extensions>true</extensions>
<dependencies>
    <dependency>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-http-lightweight</artifactId>
        <version>3.4.1</version>
    </dependency>
</dependencies>
<executions>
    <execution>
        <id>add-features-to-repo</id>
        <phase>generate-resources</phase>
        <goals>
            <goal>add-features-to-repo</goal>
        </goals>
        <configuration>
            <features>
                <feature>cxf-core/3.2.14</feature>
            </features>
        </configuration>
    </execution>
</executions>
</plugin>

以下是CXF功能中有问题的部分 - 请注意,“cxf-core”具有对“cxf-commands”功能的有条件依赖,而“cxf-commands”功能对“cxf-core”有硬依赖。这对我来说似乎是错误的,我看不到任何方法告诉插件不要陷入无限循环。

<feature name="cxf-core" version="3.2.14">
    <feature version="3.2.14">cxf-specs</feature>
    <bundle start-level="30" dependency="true">mvn:org.apache.ws.xmlschema/xmlschema-core/2.2.5</bundle>
    <bundle start-level="25" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/1.2_5</bundle>
    <bundle start-level="30" dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.fastinfoset/1.2.13_1</bundle>
    <bundle start-level="40">mvn:org.apache.cxf/cxf-core/3.2.14</bundle>
    <bundle start-level="40">mvn:org.apache.cxf/cxf-rt-management/3.2.14</bundle>
    <conditional>
        <condition>shell</condition>
        <feature version="3.2.14">cxf-commands</feature>
    </conditional>
</feature>
<feature name="cxf-commands" version="3.2.14">
    <feature>shell</feature>
    <feature version="3.2.14">cxf-core</feature>
    <bundle start-level="40">mvn:org.apache.cxf.karaf/cxf-karaf-commands/3.2.14</bundle>
</feature>
英文:

Building repo with Karaf features-maven-plugin with CXF dependency causes infinite loop.

I'm using version 2.3.12 of the org.apache.karaf.tooling/features-maven-plugin.

this seems to have started happening with CXF version 3.2.x when the circular-dependency was added between cxf-core and cxf-commands.

It outputs hundreds of these, then throws a stack overflow exception:

[INFO] Adding contents for feature: cxf-core/3.2.14
[INFO] Adding contents for feature: cxf-commands/3.2.14
[INFO] Adding contents for feature: cxf-core/3.2.14
[INFO] Adding contents for feature: cxf-commands/3.2.14

here is the pom plugin section of my pom:

                &lt;groupId&gt;org.apache.karaf.tooling&lt;/groupId&gt;
                &lt;artifactId&gt;features-maven-plugin&lt;/artifactId&gt;
                    &lt;version&gt;2.4.4&lt;/version&gt;
                    &lt;extensions&gt;true&lt;/extensions&gt;
                    &lt;dependencies&gt;
                        &lt;dependency&gt;
                            &lt;groupId&gt;org.apache.maven.wagon&lt;/groupId&gt;
                            &lt;artifactId&gt;wagon-http-lightweight&lt;/artifactId&gt;
                            &lt;version&gt;3.4.1&lt;/version&gt;
                        &lt;/dependency&gt;
                    &lt;/dependencies&gt;
                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;add-features-to-repo&lt;/id&gt;
                        &lt;phase&gt;generate-resources&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;add-features-to-repo&lt;/goal&gt;
                        &lt;/goals&gt;
                        &lt;configuration&gt;
                            &lt;features&gt;
                                &lt;feature&gt;cxf-core/3.2.14&lt;/feature&gt;
                            &lt;/features&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;

here is the offending bit of the cxf features - notice that "cxf-core" has a conditional dependency on "cxf-commands" feature and "cxf-commands" feature has a hard dependency on "cxf-core". This seems WRONG to me and I don't see any way of telling the plugin to not get into an infinite loop.

    &lt;feature name=&quot;cxf-core&quot; version=&quot;3.2.14&quot;&gt;
        &lt;feature version=&quot;3.2.14&quot;&gt;cxf-specs&lt;/feature&gt;
        &lt;bundle start-level=&quot;30&quot; dependency=&quot;true&quot;&gt;mvn:org.apache.ws.xmlschema/xmlschema-core/2.2.5&lt;/bundle&gt;
        &lt;bundle start-level=&quot;25&quot; dependency=&quot;true&quot;&gt;mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/1.2_5&lt;/bundle&gt;
        &lt;bundle start-level=&quot;30&quot; dependency=&quot;true&quot;&gt;mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.fastinfoset/1.2.13_1&lt;/bundle&gt;
        &lt;bundle start-level=&quot;40&quot;&gt;mvn:org.apache.cxf/cxf-core/3.2.14&lt;/bundle&gt;
        &lt;bundle start-level=&quot;40&quot;&gt;mvn:org.apache.cxf/cxf-rt-management/3.2.14&lt;/bundle&gt;
        &lt;conditional&gt;
            &lt;condition&gt;shell&lt;/condition&gt;
            &lt;feature version=&quot;3.2.14&quot;&gt;cxf-commands&lt;/feature&gt;
        &lt;/conditional&gt;
    &lt;/feature&gt;
    &lt;feature name=&quot;cxf-commands&quot; version=&quot;3.2.14&quot;&gt;
        &lt;feature&gt;shell&lt;/feature&gt;
        &lt;feature version=&quot;3.2.14&quot;&gt;cxf-core&lt;/feature&gt;
        &lt;bundle start-level=&quot;40&quot;&gt;mvn:org.apache.cxf.karaf/cxf-karaf-commands/3.2.14&lt;/bundle&gt;
    &lt;/feature&gt;

答案1

得分: 1

好的,以下是翻译好的部分:

"well, as it turns out, the features-maven-plugin has been superseded. This plugin works!"

"事实证明,features-maven-plugin 已经被取代。这个插件有效!"

"simply change the goal to: features-add-to-repository and make sure the <repository> is set. this is the normal one:"

"只需将目标更改为:features-add-to-repository 并确保 <repository> 已设置。这是正常的设置:"

"<repository>target/features-repo</repository>"

"and, it recognizes and supports the conditional functionality!"

"而且,它识别并支持条件功能!"

英文:

well, as it turns out, the features-maven-plugin has been superseded. This plugin works!

                &lt;groupId&gt;org.apache.karaf.tooling&lt;/groupId&gt;
                &lt;artifactId&gt;karaf-maven-plugin&lt;/artifactId&gt;

simply change the goal to: features-add-to-repository and make sure the <repository> is set. this is the normal one:

&lt;repository&gt;target/features-repo&lt;/repository&gt;

and, it recognizes and supports the conditional functionality!

huangapple
  • 本文由 发表于 2020年8月5日 06:59:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/63256174.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定