Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 渐变生成文件在生成过程中显示错误_Amazon Web Services_Gradle_Build.gradle - Fatal编程技术网

Amazon web services 渐变生成文件在生成过程中显示错误

Amazon web services 渐变生成文件在生成过程中显示错误,amazon-web-services,gradle,build.gradle,Amazon Web Services,Gradle,Build.gradle,当我合并到不同的build.gradle文件以将两个不同的功能集成到一个时,它显示了如下错误- startup failed: build file 'C:\Users\sobhit.s\Pictures\API-Update\build.gradle': 89: all buildscript {} blocks must appear before any plugins {} blocks in the script See https://docs.gradle.org/4.0/use

当我合并到不同的build.gradle文件以将两个不同的功能集成到一个时,它显示了如下错误-

startup failed:
build file 'C:\Users\sobhit.s\Pictures\API-Update\build.gradle': 89: all buildscript {} blocks must appear before any plugins {} blocks in the script

See https://docs.gradle.org/4.0/userguide/plugins.html#sec:plugins_block for information on the plugins {} block

 @ line 89, column 1.
   buildscript {
   ^

1 error

Open File

import java.util.concurrent.TimeUnit

plugins {
    id 'java'
}

apply plugin: 'java'    
group 'api_automation'
version '1.0-SNAPSHOT'   
sourceCompatibility = 1.8    
repositories {
    mavenCentral()
} 
test {
    reports {
        junitXml.enabled = true
        html.enabled = false
        reports.junitXml.destination = file("test-output/reports/")
    }
    useTestNG()
            {
                useDefaultListeners = true
                options.suites("src/test/java/testApi_Test_Scripts/smsApiAutomationSuite.xml")
                            }
}
sourceSets {
    main {
        runtimeClasspath = files(output.resourcesDir) + runtimeClasspath
    }
    test {
        runtimeClasspath = files(output.resourcesDir) + runtimeClasspath
    }
}
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
    }
}

apply plugin: "io.spring.dependency-management"
dependencyManagement {
    imports {
        mavenBom 'software.amazon.awssdk:bom:2.0.0'
    }
}
dependencies {
    compile group: 'io.rest-assured', name: 'rest-assured', version: '3.0.2'
    testCompile group: 'org.testng', name: 'testng', version: '6.8.+'
    //An assertion library that is better than JUnit defaults
    testCompile 'org.easytesting:fest-assert-core:2.0M10'
    //Better reporting for testng.  It outputs a nice html report
    testCompile 'org.uncommons:reportng:1.1.4'
    compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.15'
    compile group: 'net.sourceforge.jexcelapi', name: 'jxl', version: '2.6.12'
    compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
    compile group: 'com.googlecode.htmlcompressor', name: 'htmlcompressor', version: '1.5.2'
    compile group: 'commons-dbutils', name: 'commons-dbutils', version: '1.6'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.6'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.6'
    compile group: 'mysql', name: 'mysql-connector-java', version: '6.0.5'
    compile group: "com.github.fge", name: "json-schema-validator", version: "2.2.6"
    compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
    compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
    compile group: 'org.json', name: 'json', version: '20160810'
    compile group: 'org.uncommons', name: 'reportng', version: '1.1.4'
    compile group: 'com.google.code.guice-repository', name: 'guice-repository', version: '2.1.0'
    compile group: 'org.easytesting', name: 'fest-assert-core', version: '2.0M10'
    compile group: 'org.uncommons', name: 'reportng', version: '1.1.4'
    compile group: 'org.apache.commons', name: 'commons-csv', version: '1.5'
    compile group: 'org.apache.commons', name: 'commons-exec', version: '1.3'
    compile group: 'com.opencsv', name: 'opencsv', version: '4.1'
    compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
    compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.1'
    compile 'com.relevantcodes:extentreports:2.41.2'
    compile group: 'com.sun.mail', name: 'javax.mail', version: '1.6.0'
    compile group: 'javax.mail', name: 'javax.mail-api', version: '1.6.2'
    compile 'software.amazon.awssdk:kinesis'
    compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.534'
    compile group: 'com.amazonaws', name: 'aws-java-sdk-dynamodb', version: '1.11.539'
    compileClasspath group: 'org.testng', name: 'testng', version: '6.8.+'
}
test {
    ignoreFailures = true
}
这是合并后的build.gradle。我也不确定创建build.gradle的标准方法是什么。任何帮助都将不胜感激

我刚刚添加了build.script和mavem bom,从那时起,这就成了一个问题


在合并的脚本中,您混合了两种用于应用Gradle插件的符号:buildscript{}符号和plugins{}DSL。有关这两种符号的更多信息,请参见此处:

虽然可以混合使用这两种符号,但有一个梯度约束:必须将plugins{}块放在脚本的第一个位置,但是如果您还有一个buildscript{}块,那么它必须放在plugins{}块之前。 我将尝试在官方文档中找到指向此约束的指针

编辑:请参见插件{}块约束的说明:

plugins{}块也必须是buildscript中的顶级语句。它不能嵌套在另一个构造中,例如if语句或for循环

所以:只需移动脚本顶部的buildscript{}块

注意:更好的解决方案是去掉buildscript{}块,这是“旧”语法:

使用:

而不是

buildscript {
  repositories {
      mavenCentral()
  }
  dependencies {
     classpath "io.spring.gradle:dependency-management-plugin:1.0.7.RELEASE"
  }
}

你是天才。@M.Riccuti但是现在它在我的整个项目中给了我类路径错误。@Sobitsharma现在这是另一个问题,你需要检查你的依赖项以找到丢失/冲突的一个。最初的问题是关于构建脚本错误的,这个问题已经解决了。您没有理由取消接受以前接受的答案。请仔细检查您的依赖关系,或打开另一个问题寻求帮助
buildscript {
  repositories {
      mavenCentral()
  }
  dependencies {
     classpath "io.spring.gradle:dependency-management-plugin:1.0.7.RELEASE"
  }
}