是什么原因导致“找不到netty-transport-native-epoll-4.1.76.Final-linux-x86_64.jar”的问题?

tri*_*oid 6 gradle netty maven-shade-plugin gradle-shadow-plugin

我正在使用 Gradle Shadow jar 插件为 selenium 生成一个 fat jar。Gradle kts 中声明了以下代码:

dependencies {

    val seleniumV = "4.1.4"
    val phantomJSV = "1.5.0"
    val htmlUnitV = "3.61.0"

    // Selenium
    api("org.seleniumhq.selenium:selenium-api:${seleniumV}")
    api("org.seleniumhq.selenium:selenium-support:${seleniumV}")
}

tasks {
    shadowJar {
        exclude("META-INF/*.SF")
        exclude("META-INF/*.DSA")
        exclude("META-INF/*.RSA")
    }
}
Run Code Online (Sandbox Code Playgroud)

在我的电脑上编译成功,但是在云端编译时遇到以下错误:


FAILURE: Build failed with an exception.
02:23
* What went wrong:
02:23
Could not determine the dependencies of task ':repack:selenium-repack:shadowJar'.
02:23
> Could not resolve all files for configuration ':repack:selenium-repack:runtimeClasspath'.
02:23
   > Could not find netty-transport-native-epoll-4.1.76.Final-linux-x86_64.jar (io.netty:netty-transport-native-epoll:4.1.76.Final).
02:23
     Searched in the following locations:
02:23
         file:/home/rof/.m2/repository/io/netty/netty-transport-native-epoll/4.1.76.Final/netty-transport-native-epoll-4.1.76.Final-linux-x86_64.jar
02:23
   > Could not find netty-transport-native-kqueue-4.1.76.Final-osx-x86_64.jar (io.netty:netty-transport-native-kqueue:4.1.76.Final).
02:23
     Searched in the following locations:
02:23
         file:/home/rof/.m2/repository/io/netty/netty-transport-native-kqueue/4.1.76.Final/netty-transport-native-kqueue-4.1.76.Final-osx-x86_64.jar
02:23

Run Code Online (Sandbox Code Playgroud)

奇怪的是,在我的计算机上也找不到有问题的 jar“netty-transport-native-epoll-4.1.76.Final-linux-x86_64”。该名称似乎是从运行构建的底层操作系统自动生成的。

如果项目是使用maven编译的,并且带有maven-shade-plugin,也不会触发这个问题。

造成这种特殊错误的可能原因是什么以及如何解决?

Cam*_*amW 1

epoll 是 netty 用于本机传输的 Linux 特定 API。kqueue 对于 MacOS 来说是一样的。

这是 netty tcnative 的 wiki 页面https://netty.io/wiki/forked-tomcat-native.html

如上面的链接所示,您可以考虑包含 uber jar,它应包含所有内容netty-tcnative-boringssl-static