有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

gradle 5 windows java。木卫一。IOException:CreateProcess错误=206,文件名太长

最初,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上也会出现同样的错误


共 (3) 个答案

  1. # 1 楼答案

    看起来经过一些调整后它可以工作了

    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 }
                }
            }
    
  2. # 2 楼答案

    以下是用于构建的。格雷德尔档案

    buildscript {
        dependencies {
            classpath "gradle.plugin.ua.eshepelyuk:ManifestClasspath:1.0.0"
        }
    }
    
    apply plugin: "ua.eshepelyuk.ManifestClasspath"`
    
  3. # 3 楼答案

    您可以在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)
    

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