使用Gitlab的CI破坏了java.lang.NoClassDefFoundError:com / google / inject / util / Providers

时间:2017-10-26 14:06:35

标签: java maven docker gitlab-ci gitlab-ci-runner

我用Gitlab测试了CI。我选择了Docker Gitlab-Runners。它工作了好几周,但突然间它用

打破了它的工作
   [0KRunning with gitlab-runner 10.0.0 (2055cfdc)
  on runner ubu 003 (60d888e2)
[0;m[0KUsing Docker executor with image maven:3-jdk-8 ...
[0;m[0KUsing docker image sha256:783d31e342e7de3d0c84271624e428ef02698ea0c112b62846f0c0c6882128c1 for predefined container...
[0;m[0KPulling docker image maven:3-jdk-8 ...
[0;m[0KUsing docker image maven:3-jdk-8 ID=sha256:080cf1fccf1c3f8911bc07709347fcb1d96372674ec5e4809e109b9965dbe5fd for build container...
[0;mRunning on runner-60d888e2-project-12-concurrent-0 via 215fe72c9b4f...
[32;1mCloning repository...[0;m
Cloning into '/builds/dmgmnt/dmgmnt-central'...
[32;1mChecking out 377aedf6 as master...[0;m
[32;1mSkipping Git submodules setup[0;m
[32;1m$ mvn package -B[0;m
---------------------------------------------------
constituent[0]: file:/usr/share/maven/conf/logging/
constituent[1]: file:/usr/share/maven/lib/maven-resolver-transport-wagon-1.0.3.jar
constituent[2]: file:/usr/share/maven/lib/wagon-http-2.12-shaded.jar
constituent[3]: file:/usr/share/maven/lib/plexus-sec-dispatcher-1.4.jar
constituent[4]: file:/usr/share/maven/lib/jansi-1.13.jar
constituent[5]: file:/usr/share/maven/lib/maven-shared-utils-3.1.0.jar
constituent[6]: file:/usr/share/maven/lib/maven-repository-metadata-3.5.0.jar
constituent[7]: file:/usr/share/maven/lib/maven-plugin-api-3.5.0.jar
constituent[8]: file:/usr/share/maven/lib/cdi-api-1.0.jar
constituent[9]: file:/usr/share/maven/lib/org.eclipse.sisu.inject-0.3.3.jar
constituent[10]: file:/usr/share/maven/lib/jcl-over-slf4j-1.7.22.jar
constituent[11]: file:/usr/share/maven/lib/maven-model-builder-3.5.0.jar
constituent[12]: file:/usr/share/maven/lib/maven-resolver-util-1.0.3.jar
constituent[13]: file:/usr/share/maven/lib/maven-resolver-impl-1.0.3.jar
constituent[14]: file:/usr/share/maven/lib/wagon-file-2.12.jar
constituent[15]: file:/usr/share/maven/lib/plexus-component-annotations-1.7.1.jar
constituent[16]: file:/usr/share/maven/lib/maven-artifact-3.5.0.jar
constituent[17]: file:/usr/share/maven/lib/guice-4.0-no_aop.jar
constituent[18]: file:/usr/share/maven/lib/maven-builder-support-3.5.0.jar
constituent[19]: file:/usr/share/maven/lib/aopalliance-1.0.jar
constituent[20]: file:/usr/share/maven/lib/commons-lang3-3.5.jar
constituent[21]: file:/usr/share/maven/lib/maven-resolver-spi-1.0.3.jar
constituent[22]: file:/usr/share/maven/lib/plexus-cipher-1.7.jar
constituent[23]: file:/usr/share/maven/lib/javax.inject-1.jar
constituent[24]: file:/usr/share/maven/lib/maven-settings-builder-3.5.0.jar
constituent[25]: file:/usr/share/maven/lib/slf4j-api-1.7.22.jar
constituent[26]: file:/usr/share/maven/lib/wagon-provider-api-2.12.jar
constituent[27]: file:/usr/share/maven/lib/maven-slf4j-provider-3.5.0.jar
constituent[28]: file:/usr/share/maven/lib/maven-core-3.5.0.jar
constituent[29]: file:/usr/share/maven/lib/plexus-utils-3.0.24.jar
constituent[30]: file:/usr/share/maven/lib/plexus-interpolation-1.24.jar
constituent[31]: file:/usr/share/maven/lib/maven-compat-3.5.0.jar
constituent[32]: file:/usr/share/maven/lib/maven-resolver-connector-basic-1.0.3.jar
constituent[33]: file:/usr/share/maven/lib/commons-io-2.5.jar
constituent[34]: file:/usr/share/maven/lib/org.eclipse.sisu.plexus-0.3.3.jar
constituent[35]: file:/usr/share/maven/lib/guava-20.0.jar
constituent[36]: file:/usr/share/maven/lib/jsr250-api-1.0.jar
constituent[37]: file:/usr/share/maven/lib/maven-model-3.5.0.jar
constituent[38]: file:/usr/share/maven/lib/maven-settings-3.5.0.jar
constituent[39]: file:/usr/share/maven/lib/commons-cli-1.4.jar
constituent[40]: file:/usr/share/maven/lib/maven-embedder-3.5.0.jar
constituent[41]: file:/usr/share/maven/lib/maven-resolver-api-1.0.3.jar
constituent[42]: file:/usr/share/maven/lib/maven-resolver-provider-3.5.0.jar
---------------------------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/inject/util/Providers
    at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:192)
    at org.apache.maven.cli.MavenCli.container(MavenCli.java:675)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:338)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
    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.ClassNotFoundException: com.google.inject.util.Providers
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    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)
    ... 12 more
[31;1mERROR: Job failed: exit code 1
[0;m

如果我执行mvn sonar:sonar或直接mvn package

,这没有任何区别

我的gitlab-ci.yml

image: docker:latest
services:
  - docker:dind

variables:
  DOCKER_DRIVER: overlay

stages:
  - sonar
  - build
  - package

maven-build:
  image: maven:latest
  stage: sonar
  script:
    - "mvn --batch-mode verify sonar:sonar -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN_TOKEN -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME"

maven-deploy:
  only:
    - develop@dmgmnt/dmgmnt-central
  image: maven:latest
  stage: build
  script: 
    - "mvn -U clean install spring-boot:repackage"
  artifacts:
    paths:
      - target/*.war

docker-build:
  only:
    - develop@dmgmnt/dmgmnt-central
  stage: package
  script:
  - docker login -u toner -p $DOCKER_REGISTRY_ACCESS gitlab.server:4567
  - docker build -t gitlab.server:4567/$CI_PROJECT_PATH:$CI_COMMIT_REF_NAME .
  - docker push gitlab.server:4567/$CI_PROJECT_PATH:$CI_COMMIT_REF_NAME

/srv/gitlab-runner/config/config.toml

concurrent = 1
check_interval = 0

[[runners]]
  name = "runner ubu 001"
  url = "http://192.168.80.10/"
  token = "adfae5e0c688ca8ba8aa6942900878"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "maven:3-jdk-8"
    privileged = true
    disable_cache = false
    volumes = ["/mnt/dockerhost/gitlab-runner/.m2/settings.xml:/root/.m2/settings.xml","/cache"]
    shm_size = 0
  [runners.cache]

我试图更新跑步者,但这并没有让事情变得更好。我不知道从哪里开始修复它。根据给定的例外,我没有找到解决方案。

我希望有人可以帮助我。

由于

0 个答案:

没有答案