当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
答案 0 :(得分: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
运行它。