Jenkins和Maven的间歇性构建错误

时间:2018-03-23 12:53:14

标签: java maven jenkins

我们遇到了一个非常持久的问题,我不知道如何继续跟踪它。

当在Jenkins中开始构建时,它们有时会因为我不知道的原因而失败。

错误并不总是显示,但错误消息是一致的。 它始终在下面的记录步骤中失败。

mvn --batch-mode -Dmaven.repo.local=/home/jenkins/jenkins/workspace/enial_amd64_javatools_PR-22-GHW7GOQFGYL5OCAMXQPD3JBXZFV6ALWUZZKH3IAEPERM6ZYB6SEA/.m2/repository clean install
---------------------------------------------------
constituent[0]: file:/usr/share/maven/lib/commons-lang.jar
constituent[1]: file:/usr/share/maven/lib/plexus-component-annotations.jar
constituent[2]: file:/usr/share/maven/lib/maven-builder-support-3.x.jar
constituent[3]: file:/usr/share/maven/lib/eclipse-aether-api.jar
constituent[4]: file:/usr/share/maven/lib/plexus-interpolation.jar
constituent[5]: file:/usr/share/maven/lib/guice.jar
constituent[6]: file:/usr/share/maven/lib/plexus-utils.jar
constituent[7]: file:/usr/share/maven/lib/cdi-api.jar
constituent[8]: file:/usr/share/maven/lib/maven-model-3.x.jar
constituent[9]: file:/usr/share/maven/lib/slf4j-simple.jar
constituent[10]: file:/usr/share/maven/lib/maven-settings-builder-3.x.jar
constituent[11]: file:/usr/share/maven/lib/aopalliance.jar
constituent[12]: file:/usr/share/maven/lib/commons-io.jar
constituent[13]: file:/usr/share/maven/lib/maven-model-builder-3.x.jar
constituent[14]: file:/usr/share/maven/lib/plexus-sec-dispatcher.jar
constituent[15]: file:/usr/share/maven/lib/sisu-plexus.jar
constituent[16]: file:/usr/share/maven/lib/jsoup.jar
constituent[17]: file:/usr/share/maven/lib/eclipse-aether-transport-wagon.jar
constituent[18]: file:/usr/share/maven/lib/eclipse-aether-spi.jar
constituent[19]: file:/usr/share/maven/lib/eclipse-aether-connector-basic.jar
constituent[20]: file:/usr/share/maven/lib/sisu-inject.jar
constituent[21]: file:/usr/share/maven/lib/eclipse-aether-util.jar
constituent[22]: file:/usr/share/maven/lib/guava.jar
constituent[23]: file:/usr/share/maven/lib/maven-embedder-3.x.jar
constituent[24]: file:/usr/share/maven/lib/commons-lang3.jar
constituent[25]: file:/usr/share/maven/lib/maven-compat-3.x.jar
constituent[26]: file:/usr/share/maven/lib/wagon-http-shared.jar
constituent[27]: file:/usr/share/maven/lib/wagon-http-shaded.jar
constituent[28]: file:/usr/share/maven/lib/slf4j-api.jar
constituent[29]: file:/usr/share/maven/lib/eclipse-aether-impl.jar
constituent[30]: file:/usr/share/maven/lib/plexus-cipher.jar
constituent[31]: file:/usr/share/maven/lib/maven-core-3.x.jar
constituent[32]: file:/usr/share/maven/lib/maven-repository-metadata-3.x.jar
constituent[33]: file:/usr/share/maven/lib/maven-plugin-api-3.x.jar
constituent[34]: file:/usr/share/maven/lib/commons-cli.jar
constituent[35]: file:/usr/share/maven/lib/wagon-provider-api.jar
constituent[36]: file:/usr/share/maven/lib/javax.inject.jar
constituent[37]: file:/usr/share/maven/lib/maven-settings-3.x.jar
constituent[38]: file:/usr/share/maven/lib/maven-aether-provider-3.x.jar
constituent[39]: file:/usr/share/maven/lib/maven-artifact-3.x.jar
constituent[40]: file:/usr/share/maven/lib/wagon-file.jar
constituent[41]: file:/usr/share/maven/conf/logging/
---------------------------------------------------
Exception in thread "main" com.google.common.util.concurrent.ExecutionError: java.lang.ClassFormatError: Signature index 36620 in LocalVariableTable has bad constant type in class file com/google/inject/internal/cglib/core/$CodeEmitter
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3955)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4870)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4876)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:48)
    at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:50)
    at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:137)
    at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:533)
    at com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:160)
    at com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:44)
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:123)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
    at com.google.inject.Guice.createInjector(Guice.java:99)
    at com.google.inject.Guice.createInjector(Guice.java:73)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:481)
    at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:206)
    at org.apache.maven.cli.MavenCli.container(MavenCli.java:545)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:281)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassFormatError: Signature index 36620 in LocalVariableTable has bad constant type in class file com/google/inject/internal/cglib/core/$CodeEmitter
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
    at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:77)
    at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:231)
    at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:65)
    at com.google.inject.internal.BytecodeGen.newFastClass(BytecodeGen.java:204)
    at com.google.inject.internal.DefaultConstructionProxyFactory.create(DefaultConstructionProxyFactory.java:55)
    at com.google.inject.internal.ProxyFactory.create(ProxyFactory.java:159)
    at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:90)
    at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:29)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:37)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
    at com.google.inject.internal.FailableCache$1.load(FailableCache.java:37)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3540)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2321)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2284)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
    ... 28 more

这些存储库包含许多具有不同Java目标版本的不同项目。失败的构建是Java 7和8的混合,我们不构建任何其他版本。失败的构建似乎是随机的,失败的构建数量也是如此。有时它们都会通过,有时4-5会失败。

抛出的异常似乎来自Guava或Guice。

谷歌搜索此错误会返回大量不同的原因,其中大多数似乎与Java版本有关,但我无法弄清楚为什么我们会随机看到这一点。

任何有类似错误的提示或经验都将不胜感激。

更新

这是Dockerfile的内容:

FROM ubuntu:xenial

RUN apt-get --yes update && apt-get --yes install \
    build-essential \
    cmake \
    curl \
    git \
    maven \
    openjdk-8-jdk-headless \

EXPOSE 22

在管道脚本中,我们将结果图像指向代理。

然后我们使用docker run -v $WORKSPACE:WORKSPACE -w $WORKSPACE从Jenkins安装工作区。从这里开始,mvn --batch-mode就会发布。

0 个答案:

没有答案