操作步骤

1、在 jmeter 源码下载源码,解压到本地
2、在解压目录执行命令 gradlew build 报错

环境

操作系统:Windows7,64 位
java 版本:1.8.0_201

报错信息

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':buildSrc:autostyleKotlinGradleCheck'.
> The following files have format violations:
    build.gradle.kts
      @@ -1,77 +1,77 @@
      -/*\n
      - * Licensed to the Apache Software Foundation (ASF) under one or more\n
      - * contributor license agreements.  See the NOTICE file distributed with\n
      - * this work for additional information regarding copyright ownership.\n
      - * The ASF licenses this file to You under the Apache License, Version 2.0\n
      - * (the "License"); you may not use this file except in compliance with\n
      - * the License.  You may obtain a copy of the License at\n
      - *\n
      - *   http://www.apache.org/licenses/LICENSE-2.0\n
      - *\n
      - * Unless required by applicable law or agreed to in writing, software\n
      - * distributed under the License is distributed on an "AS IS" BASIS,\n
      - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n
      - * See the License for the specific language governing permissions and\n
      - * limitations under the License.\n
      - *\n
      - */\n
      -\n
      -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile\n
      -\n
      -plugins {\n
      -    java\n
      -    `kotlin-dsl` apply false\n
      -    id("com.github.autostyle")\n
      -}\n
      -\n
      -repositories {\n
      -    jcenter()\n
      -    gradlePluginPortal()\n
      -}\n
      -\n
      -allprojects {\n
      -    repositories {\n
      -        jcenter()\n
      -        gradlePluginPortal()\n
      -    }\n
      -    applyKotlinProjectConventions()\n
      -}\n
      -\n
      -fun Project.applyKotlinProjectConventions() {\n
      -    apply(plugin = "org.gradle.kotlin.kotlin-dsl")\n
      -\n
      -    plugins.withType<KotlinDslPlugin> {\n
      -        configure<KotlinDslPluginOptions> {\n
      -            experimentalWarning.set(false)\n
      -        }\n
      -    }\n
      -\n
    ... (106 more lines that didn't fit)
  Violations also present in:
    settings.gradle.kts
  You might want to adjust -PmaxCheckMessageLines=50 -PmaxFilesToList=10 -PminLinesPerFile=4 to see more violations
  Run './gradlew autostyleApply' to fix the violations.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':buildSrc:batchtest:autostyleKotlinCheck'.
> The following files have format violations:
    subprojects\batchtest\src\main\kotlin\org\apache\jmeter\buildtools\batchtest\BatchTest.kt
      @@ -1,213 +1,213 @@
      -/*\n
      - * Licensed to the Apache Software Foundation (ASF) under one or more\n
      - * contributor license agreements.  See the NOTICE file distributed with\n
      - * this work for additional information regarding copyright ownership.\n
      - * The ASF licenses this file to You under the Apache License, Version 2.0\n
      - * (the "License"); you may not use this file except in compliance with\n
      - * the License.  You may obtain a copy of the License at\n
      - *\n
      - *   http://www.apache.org/licenses/LICENSE-2.0\n
      - *\n
      - * Unless required by applicable law or agreed to in writing, software\n
      - * distributed under the License is distributed on an "AS IS" BASIS,\n
      - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n
      - * See the License for the specific language governing permissions and\n
      - * limitations under the License.\n
      - *\n
      - */\n
      -\n
      -package org.apache.jmeter.buildtools.batchtest\n
      -\n
      -import org.eclipse.jgit.diff.DiffAlgorithm\n
      -import org.eclipse.jgit.diff.DiffFormatter\n
      -import org.eclipse.jgit.diff.RawText\n
      -import org.eclipse.jgit.diff.RawTextComparator\n
      -import org.eclipse.jgit.util.io.AutoCRLFInputStream\n
      -import org.gradle.api.GradleException\n
      -import org.gradle.api.model.ObjectFactory\n
      -import org.gradle.api.tasks.Input\n
      -import org.gradle.api.tasks.InputDirectory\n
      -import org.gradle.api.tasks.InputFile\n
      -import org.gradle.api.tasks.InputFiles\n
      -import org.gradle.api.tasks.Internal\n
      -import org.gradle.api.tasks.JavaExec\n
      -import org.gradle.kotlin.dsl.property\n
      -import java.io.File\n
      -import java.net.InetAddress\n
      -import javax.inject.Inject\n
      -\n
      -open class BatchTest @Inject constructor(objects: ObjectFactory) : JavaExec() {\n
      -    companion object {\n
      -        const val BATCH_TESTS_GROUP_NAME = "Batch test"\n
      -    }\n
      -\n
      -    @Input\n
      -    val ignoreErrorLogs = objects.property<Boolean>().convention(false)\n
      -\n
      -    @Input\n
      -    val testName = objects.property<String>()\n
    ... (378 more lines that didn't fit)
  Violations also present in:
    subprojects\batchtest\src\main\kotlin\org\apache\jmeter\buildtools\batchtest\BatchtestPlugin.kt
    subprojects\batchtest\src\main\kotlin\org\apache\jmeter\buildtools\batchtest\BatchTestServer.kt
    subprojects\batchtest\src\main\kotlin\org\apache\jmeter\buildtools\batchtest\WriterExtensions.kt
  You might want to adjust -PmaxCheckMessageLines=50 -PmaxFilesToList=10 -PminLinesPerFile=4 to see more violations
  Run './gradlew autostyleApply' to fix the violations.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings

CONFIGURE FAILED in 3s


↙↙↙阅读原文可查看相关链接,并与作者交流