繁体   English   中英

gradle 5 - windows java.io.IOException: CreateProcess error=206, 文件名太长

[英]gradle 5 - windows java.io.IOException: CreateProcess error=206, filename is too long

最初, gradle windows java.io.IOException: CreateProcess error=206, filename is too long是一个很好的解决方案。 但是,对于 gradle 5:

CollectionUtils.join(File.pathSeparator, classpath.getFiles())

失败

 unknown property 'CollectionUtils' type org.gradle.api.tasks.testing.Test

什么是 gradle 5.0 的合适修复?

至少对我来说: https : //github.com/viswaramamoorthy/gradle-util-plugins/在 gradle 5.0 上也失败并出现相同的错误

您可以在 gradle buildscript 中使用外部库。

例子:

buildscript {
   repositories {
      mavenCentral()
   }
   dependencies {
      // this dependency will be used in gradle build script.
      classpath 'org.apache.commons:commons-lang3:3.8.1'
   }
}
//and use it like this in Your tasks
org.apache.commons.lang3.StringUtils.join(configurations.testRuntime,File.pathSeparator)

我不确定这是否会解决您的问题,但是您也可以尝试其他类似的库。

看起来像经过一些调整后工作

doFirst {
            if (org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS) {
                def cp = org.gradle.util.CollectionUtils.join(File.pathSeparator, classpath.getFiles())
                environment 'CLASSPATH', cp
                classpath = classpath.filter { false }
            }
        }

以下是 build.gradle 文件。

buildscript {
    dependencies {
        classpath "gradle.plugin.ua.eshepelyuk:ManifestClasspath:1.0.0"
    }
}

apply plugin: "ua.eshepelyuk.ManifestClasspath"`

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM