gradle依赖替换在WIN与Linux上的不同行为

时间:2019-07-16 14:21:32

标签: windows gradle dependencies guava

我在使用Gradle构建的项目中有一些番石榴冲突。 Gradle将替换为最新(当前)版本:

variant "compile" [
      org.gradle.status              = release (not requested)
      org.gradle.usage               = java-api
      org.gradle.category            = library (not requested)

      Requested attributes not found in the selected variant:
         org.gradle.dependency.bundling = external
         org.gradle.jvm.version         = 8
   ]
   Selection reasons:
      - By conflict resolution : between versions 17.0, 11.0.2, 16.0.1 and 25.1-jre

在Linx / Osx上,一切都很好。这也适用于基于Centos的CI管道。但是在Windows上:

java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: com.google.common.base.Enums.valueOfFunction(Ljava/lang/Class;)Lcom/google/common/base/Function;
  at java.util.concurrent.FutureTask.report(FutureTask.java:122)
  at java.util.concurrent.FutureTask.get(FutureTask.java:192)
  at org.scalatest.tools.ConcurrentDistributor.waitUntilDone(ConcurrentDistributor.scala:50)
  at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1334)
  at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1012)
  at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1011)
  at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1509)
  at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1011)
  at org.scalatest.tools.Runner$.main(Runner.scala:827)
  at org.scalatest.tools.Runner.main(Runner.scala)
  ...
  Cause: java.lang.NoSuchMethodError: com.google.common.base.Enums.valueOfFunction(Ljava/lang/Class;)Lcom/google/common/base/Function;
  at org.apache.hadoop.fs.shell.XAttrCommands$GetfattrCommand.<clinit>(XAttrCommands.java:69)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:132)
  at org.apache.hadoop.fs.shell.CommandFactory.getInstance(CommandFactory.java:125)
  at org.apache.hadoop.fs.shell.CommandFactory.getInstance(CommandFactory.java:109)
  at org.apache.hadoop.fs.FsShell.printInfo(FsShell.java:222)
  at org.apache.hadoop.fs.FsShe

以某种方式选择了其他版本的番石榴,这会在执行单元测试期间导致NoSuchMethodError

我该怎么做才能进一步调试和解决此问题?似乎很奇怪。

0 个答案:

没有答案