【问题标题】:Build Failure: Version increase required: Failed to execute goal org.apache.felix:maven-bundle-plugin:3.0.1:baseline构建失败:需要增加版本:无法执行目标 org.apache.felix:maven-bundle-plugin:3.0.1:baseline
【发布时间】:2025-11-28 15:30:01
【问题描述】:

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

 --- 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 个小时,仍然无法找到根本原因。早些时候,这工作正常。但最近它开始给出问题版本需要更新。

【问题讨论】:

    标签: maven osgi apache-felix maven-bundle-plugin


    【解决方案1】:

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

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

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

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

    【讨论】:

      【解决方案2】:

      基于 AEM 6.5

      我按照其他人的指示尝试了 -Dbaseline.skip=true 选项,但仍然失败。

      本文在此:https://felix.apache.org/components/bundle-plugin/baseline-mojo.html

      谈论添加“跳过”属性。

      然后我在我的 core 模块下添加了这个属性,如下所示,一切正常:

      <plugin>
          <groupId>biz.aQute.bnd</groupId>
          <artifactId>bnd-baseline-maven-plugin</artifactId>
          <configuration>
              <failOnMissing>false</failOnMissing>
              <skip>true</skip>
          </configuration>
      </plugin>
      

      【讨论】:

      • 备注:其他答案(和问题)使用maven-bundle-plugin,而您使用bnd-baseline-maven-plugin。这应该可以解释行为上的差异。
      【解决方案3】:

      我运行了命令: mvn clean -Dbaseline.skip=true 安装, 它就像一个魅力

      【讨论】:

      • 我遇到了同样的问题并跳过了基线,但仍然失败。还有其他想法吗?
      最近更新 更多