【问题标题】:Jenkins job [ERROR] 'dependencies.dependency.version' for org.apache.lucene:lucene-core:jar must be a valid versionorg.apache.lucene:lucene-core:jar 的 Jenkins 作业 [错误] 'dependencies.dependency.version' 必须是有效版本
【发布时间】:2017-07-03 14:24:50
【问题描述】:

当 Jenkins 作业执行 Maven 源代码时,控制台中显示以下错误并且作业失败。由于项目有很多模块。我无法修改 pom.xml 文件以通过硬编码版本来修复错误。不知何故我想通过添加某种配置来解决 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

【问题讨论】:

    标签: maven jenkins pom.xml


    【解决方案1】:

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

    <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 运行它。

    【讨论】:

    • 我想将 Jenkins 目标添加到上述命令中。我添加了 clean install package -D 但它没有用
    • 你加mvn clean install -Dlucene.version=6.6.0了吗?
    • Jenkins 中的 命令 clean install -Dlucene.version=6.6.0 解决了错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-05
    • 2021-08-03
    • 1970-01-01
    • 2018-09-28
    • 1970-01-01
    • 2016-03-03
    相关资源
    最近更新 更多