首页 > 解决方案 > 构建失败:需要增加版本:无法执行目标 org.apache.felix:maven-bundle-plugin:3.0.1:baseline

问题描述

以下是当我向现有代码添加任何新方法时遇到的错误(尤其是当我向接口或类添加任何方法时)

 --- animal-sniffer-maven-plugin:1.15:check (default) @ deepser ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java18:1.0
[INFO]
[INFO] --- maven-bundle-plugin:3.0.1:bundle (default-bundle) @ deepser ---
[INFO]
[INFO] --- maven-bundle-plugin:3.0.1:baseline (baseline) @ deepser ---
[INFO] Baseline Report - Generated by Apache Felix Maven Bundle Plugin on 2018-07-09T20:24Z based on Bnd - see http://www.aqute.biz/Bnd/Bnd
[INFO] Comparing bundle deepser version 18.6.5-SNAPSHOT to version 18.6.4
[INFO]
[INFO]   PACKAGE_NAME                                       DELTA      CUR_VER    BASE_VER   REC_VER    WARNINGS
[INFO] = ================================================== ========== ========== ========== ========== ==========
[INFO] * com.myowncompany.analytica.deepser.config               major      18.6.5     18.6.4     19.0.0     Version increase required
[INFO]      > interface com.myowncompany.analytica.deepser.config.DeepSearchConfig
[INFO]          + method getDeepSearchLibsCDNUrl()
[INFO]              + access abstract
[INFO]              + return java.lang.String
[INFO]      - version 18.6.4
[INFO]      + version 18.6.5
[INFO] -----------------------------------------------------------------------------------------------------------
[INFO] * com.myowncompany.analytica.deepser.config.impl          minor      18.6.5     18.6.4     18.7.0     Version increase required
[INFO]      < class com.myowncompany.analytica.deepser.config.impl.DeepSearchConfigImpl
[INFO]          + method getDeepSearchLibsCDNUrl()
[INFO]              + return java.lang.String
[INFO]      - version 18.6.4
[INFO]      + version 18.6.5
[INFO] -----------------------------------------------------------------------------------------------------------
[ERROR] com.myowncompany.analytica.deepser.config: Version increase required; detected 18.6.5, suggested 19.0.0
[ERROR] com.myowncompany.analytica.deepser.config.impl: Version increase required; detected 18.6.5, suggested 18.7.0
[INFO] Baseline analysis complete, 2 error(s), 0 warning(s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.179 s
[INFO] Finished at: 2018-07-09T20:24:41+05:30
[INFO] Final Memory: 41M/1038M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:3.0.1:baseline (baseline) on project deepser: Baseline failed, see generated report -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=1024m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0

我的 pom.xml 包含以下插件:

 <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-scr-plugin</artifactId>
        <version>${scr.plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${mvn.bundle.plugin.version}</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
            <Bundle-Category>search</Bundle-Category>
            <!-- Export only the packages that should be visible to other bundles
              and JSPs -->
            <Export-Package>
              com.myowncompany.analytica.*
            </Export-Package>
            </instructions>
        </configuration>
      </plugin>

任何想法......我用谷歌搜索了它,花了 3 个小时,仍然无法找到根本原因。早些时候,这工作正常。但最近它开始给出问题版本需要更新。

标签: mavenosgiapache-felixmaven-bundle-plugin

解决方案


基线插件检查导出的包是否根据语义版本控制规则更改。默认情况下,它将新包中类的签名与最新版本进行比较。

结果告诉您,impl 包需要增加小版本,而 .config 包需要增加主要版本。

如果您不打算运行基线目标,您可以使用 maven 属性跳过它:baseline.skip=true

顺便提一句。您应该只对 API 包运行基线检查。在 impl 上它们没有多大意义.. 但是你应该尽量不要导出 impl 包。


推荐阅读