当使用“捆绑"时,使用maven-bundle-plugin目标打包执行两次 [英] When using "bundle" packaging with maven-bundle-plugin goals are executed twice

查看:156
本文介绍了当使用“捆绑"时,使用maven-bundle-plugin目标打包执行两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个(简单的)maven项目,使用org.apache.felix:maven-bundle-plugin:2.5.4打包类型为"bundle".它产生一个正确的OSGI捆绑罐.但是我观察到所有目标至少要执行两次.我该如何预防呢?问题在于某些目标(在此示例中为checkstyle)的速度很慢,因此此处重复执行是一个问题.

I have a (simple) maven project with packaging type "bundle" using org.apache.felix:maven-bundle-plugin:2.5.4. It produces a correct OSGI bundle jar. However i observe that all goals are executed at least twice. How do i prevent this? Problem is that some goals (checkstyle in this example) are slow so duplicate execution is a problem here.

注意:我从命令行使用maven 3.2.5.

NOTE: I use maven 3.2.5 from the command line.

输出或mvn clean install(已删除所有不相关的信息).请注意,许多插件执行了4次. maven-checkstyle-plugin被执行两次.

Output or mvn clean install (removed all irrelevant info). Notice that many plugins are executed 4 times. maven-checkstyle-plugin is execurted twice.

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ my-project ---
[INFO] --- maven-enforcer-plugin:1.4:enforce (enforce-maven) @ my-project ---
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ my-project ---
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ my-project ---
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ my-project ---
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ my-project ---
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ my-project ---
[INFO] >>> maven-bundle-plugin:2.5.4:bundle (default-bundle) > package @ my-project >>>
[INFO] --- maven-enforcer-plugin:1.4:enforce (enforce-maven) @ my-project ---
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ my-project ---
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ my-project ---
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ my-project ---
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ my-project ---
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ my-project ---
[INFO] <<< maven-bundle-plugin:2.5.4:bundle (default-bundle) < package @ my-project <<<
[INFO] --- maven-bundle-plugin:2.5.4:bundle (default-bundle) @ my-project ---
[INFO] --- maven-checkstyle-plugin:2.15:check (checkstyle-main) @ my-project ---
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ my-project ---
[INFO] >>> maven-bundle-plugin:2.5.4:install (default-install) > install @ my-project >>>
[INFO] --- maven-enforcer-plugin:1.4:enforce (enforce-maven) @ my-project ---
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ my-project ---
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ my-project ---
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ my-project ---
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ my-project ---
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ my-project ---
[INFO] >>> maven-bundle-plugin:2.5.4:bundle (default-bundle) > package @ my-project >>>
[INFO] --- maven-enforcer-plugin:1.4:enforce (enforce-maven) @ my-project ---
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ my-project ---
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ my-project ---
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ my-project ---
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ my-project ---
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ my-project ---
[INFO] <<< maven-bundle-plugin:2.5.4:bundle (default-bundle) < package @ my-project <<<
[INFO] --- maven-bundle-plugin:2.5.4:bundle (default-bundle) @ my-project ---
[INFO] --- maven-checkstyle-plugin:2.15:check (checkstyle-main) @ my-project ---
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ my-project ---
[INFO] <<< maven-bundle-plugin:2.5.4:install (default-install) < install @ my-project <<<
[INFO] --- maven-bundle-plugin:2.5.4:install (default-install) @ my-project ---

其他信息:

父POM

<project ...>
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
    </parent>
    ...
    <version>3.0.5-SNAPSHOT</version>
    <packaging>pom</packaging>
    ...
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>2.5.4</version>
                    <extensions>true</extensions>
                    <inherited>true</inherited>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

用于OSGI捆绑软件的POM:

POM for OSGI bundle:

<project ...>
    <parent>
        <groupId>myGroupId</groupId>
        <artifactId>myArtifactId</artifactId>
        <version>3.0.5-SNAPSHOT</version>
        <relativePath>../</relativePath>
    </parent>
    ...
    <packaging>bundle</packaging>
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Export-Package>myPackage</Export-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

更新:这是一个已知的错误(另请参见答案K Erlandsson): https://issues.apache.org/jira/browse/FELIX-4882

UPDATE: This is a known bug (also see answer K Erlandsson): https://issues.apache.org/jira/browse/FELIX-4882

此问题现已解决(maven-bundle-plugin-2.5.5)

推荐答案

编辑:由于问题中 rmuller 已更新,因此存在错误: https://issues.apache.org/jira/browse/FELIX-4882 .该错误已在版本3.0.0中修复.

Edit: As rmuller have updated in the question, it is a bug: https://issues.apache.org/jira/browse/FELIX-4882. The bug is fixed in version 3.0.0.

我记得我们在将maven-bundle-plugin升级到2.5.4时遇到了类似的问题(特别是,捆绑软件部署了两次).我们将其降级为2.5.3以解决我们的问题.

I recall us having a similar problem (specifically, the bundle was deployed twice) when we upgraded maven-bundle-plugin to 2.5.4. We downgraded it to 2.5.3 to solve our problems.

我还没有更深入地研究这是否是一个错误,或者是否还有其他配置2.5.4的要求.

I have not dug deeper to see if this is a bug or if there are just other requirements for configuration for 2.5.4.

这篇关于当使用“捆绑"时,使用maven-bundle-plugin目标打包执行两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆