我突然看到CI Maven构建失败,并显示以下内容:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project CheckoutMs: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile: java.lang.NoSuchMethodError: org.codehaus.plexus.compiler.CompilerConfiguration.isParameters()Z
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-compiler-plugin:3.6.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/jenkins/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/3.6.1/maven-compiler-plugin-3.6.1.jar
[ERROR] urls[1] = file:/home/jenkins/.m2/repository/org/codehaus/groovy/groovy-eclipse-compiler/3.3.0-01/groovy-eclipse-compiler-3.3.0-01.jar
[ERROR] urls[2] = file:/home/jenkins/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.6/plexus-component-annotations-1.6.jar
[ERROR] urls[3] = file:/home/jenkins/.m2/repository/org/apache/xbean/xbean-reflect/3.7/xbean-reflect-3.7.jar
[ERROR] urls[4] = file:/home/jenkins/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar
[ERROR] urls[5] = file:/home/jenkins/.m2/repository/org/codehaus/groovy/groovy-eclipse-batch/2.5.5-01/groovy-eclipse-batch-2.5.5-01.jar
[ERROR] urls[6] = file:/home/jenkins/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[7] = file:/home/jenkins/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[8] = file:/home/jenkins/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.4/plexus-utils-2.0.4.jar
[ERROR] urls[9] = file:/home/jenkins/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[10] = file:/home/jenkins/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[11] = file:/home/jenkins/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[12] = file:/home/jenkins/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[13] = file:/home/jenkins/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.1.0/maven-shared-utils-3.1.0.jar
[ERROR] urls[14] = file:/home/jenkins/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[ERROR] urls[15] = file:/home/jenkins/.m2/repository/org/apache/maven/shared/maven-shared-incremental/1.1/maven-shared-incremental-1.1.jar
[ERROR] urls[16] = file:/home/jenkins/.m2/repository/org/ow2/asm/asm/6.0_ALPHA/asm-6.0_ALPHA.jar
[ERROR] urls[17] = file:/home/jenkins/.m2/repository/com/thoughtworks/qdox/qdox/2.0-M5/qdox-2.0-M5.jar
[ERROR] urls[18] = file:/home/jenkins/.m2/repository/org/codehaus/plexus/plexus-compiler-api/2.8.1/plexus-compiler-api-2.8.1.jar
[ERROR] urls[19] = file:/home/jenkins/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/2.8.1/plexus-compiler-manager-2.8.1.jar
[ERROR] urls[20] = file:/home/jenkins/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/2.8.1/plexus-compiler-javac-2.8.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
通过一些分析,我可以看到“ isParameters”方法在plexus-compiler-api的2.8.3版本中可用,但在2.8.1中不可用,此处使用了该方法。这不是正在构建的项目的直接或间接依赖项。
此错误在正在发生的项目中是可重复的。它开始发生在午夜后2分钟(从1/26开始)。在此之前的6分钟之前的前一天,它的先前版本没有看到此症状。
我还查看了为此构建从每个存储库中提取的git commit id,它们在上次成功构建与第一次(持续)失败之间是相同的。
这意味着基础架构必须有所更改。我不坚持。一个不同的团队。我想从这篇文章中得到的是我可以传递的有关可能导致这一问题的变化的任何线索。
答案 0 :(得分:1)
这是由于plexus-compiler-eclipse
无法正确解决其对plexus-compiler-api
的依赖性所引起的。不知道为什么-这是它的pom.xml
。
当前正在通过Maven编译器插件来解析该依赖项的版本,这就是为什么将其更新为最新版本的原因,例如:
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
修复依赖关系,例如它会导致:
< [INFO] org.codehaus.plexus:plexus-compiler-api:jar:2.8.1
< [INFO] org.codehaus.plexus:plexus-compiler-manager:jar:2.8.1
< [INFO] org.codehaus.plexus:plexus-compiler-javac:jar:2.8.1
---
> [INFO] org.codehaus.plexus:plexus-compiler-api:jar:2.8.4
> [INFO] org.codehaus.plexus:plexus-compiler-manager:jar:2.8.4
> [INFO] org.codehaus.plexus:plexus-compiler-javac:jar:2.8.4
导致该问题的API更改是在this commit中引入的,该更改首先在插件2.8.2中发布,这就是为什么引用最新的例如2.8.6而不通过maven-compiler-plugin
过渡地触发API依赖关系的原因导致此问题。