Jenkins 作业 [ERROR] 'dependencies.dependency.version' for org.apache.lucene:lucene-core:jar 必须是有效版本

Jenkins job [ERROR] 'dependencies.dependency.version' for org.apache.lucene:lucene-core:jar must be a valid version

当 Jenkins 作业执行 Maven 源代码时,控制台和作业中显示错误 failed.Since 项目太多 modules.I 无法修改 pom.xml 文件来修复硬编码错误 version.Somehow 我想通过添加某种配置从 Jenkins 端解决错误。

 [ERROR]     'dependencies.dependency.version' for org.apache.lucene:lucene-core:jar must be a valid version but is '${lucene.version}'. @ org.helloproject.search:customer-impl:[unknown-version], /var/lib/jenkins/workspace/HelloProject/search/customer-impl/impl/pom.xml, line 182, column 16
    [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/ProjectBuildingException
    Build step 'Invoke top-level Maven targets' marked build as failure
    Finished: FAILURE

属性是避免硬编码依赖的常用方法。

<project>
    <properties>
        <!-- Override this value: -Dlucene.version=6.6.0 -->
        <lucene.version>OVERRIDE_ME</lucene.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
            <version>${lucene.version}</version>
        </dependency>
    </dependencies>
</project>

然后 运行 它由 mvn clean install -Dlucene.version=6.6.0

然而,根据您的错误日志,我认为它已经在您的项目中完成,所以只需尝试 运行 在 Jenkins 中使用 -Dlucene.version=6.6.0 即可。