Build failed in SpringBoot+Gradle proyect


(Osmay Moya Miranda) #1

Hello! Im starting in Kotlin and Gradle. In build.gradle file I apply the kotlin plugin and when I Run Gradle Tasks throw this error

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘D:\Proyectos\Peaje\PosWebService\PosWebService\build.gradle’ line: 26

  • What went wrong:
    A problem occurred evaluating root project ‘PosWebService’.

org/jetbrains/kotlin/cli/common/PropertiesKt

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

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

BUILD FAILED in 0s

this is my build.gradle

/*

buildscript {
ext.kotlin_version = '1.1.2-4’
ext.spring_boot_version = '1.5.6.RELEASE’
repositories {
flatDir { dirs ‘lib’ }
}
dependencies {
// Needed for the kotlin plugin
classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version”
// Needen for the ‘org.springframework.boot’ plugin
classpath “org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version”
// Needed for the ‘kotlin-spring’ plugin
classpath “org.jetbrains.kotlin:kotlin-allopen:$kotlin_version”
}
}

// Apply the kotlin plugin to add support for Kotlin Library
apply plugin: 'kotlin’
apply plugin: 'eclipse’
apply plugin: "kotlin-spring"
apply plugin: ‘org.springframework.boot’

jar {
baseName = 'PosWebService’
version = ‘0.0.1-SNAPSHOT’
}

// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
flatDir { dirs ‘lib’ }
}

dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api ‘org.apache.commons:commons-math3:3.6.1’

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:22.0'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'org.springframework.boot:spring-boot-starter-web'

}

Please can sameone help me


(Osmay Moya Miranda) #2

I have include the Kotlin’s compiler (classpath “org.jetbrains.kotlin:kotlin-compiler:$kotlin_version”) but now have change the error

the new error:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred evaluating root project ‘PosWebService’.

org/jetbrains/kotlin/com/intellij/util/ReflectionUtil

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED in 0s

build.gradle

/*

buildscript {
ext.kotlin_version = '1.1.4-3’
ext.spring_boot_version = '1.5.6.RELEASE’
repositories {
flatDir { dirs ‘lib’ }
}
dependencies {
// Needed for the kotlin plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath “org.jetbrains.kotlin:kotlin-compiler:$kotlin_version”
// Needen for the ‘org.springframework.boot’ plugin
classpath “org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_version”
// Needed for the ‘kotlin-spring’ plugin
classpath “org.jetbrains.kotlin:kotlin-allopen:$kotlin_version”
}
}

// Apply the kotlin plugin to add support for Kotlin Library
apply plugin: 'kotlin’
apply plugin: 'eclipse’
apply plugin: "kotlin-spring"
apply plugin: ‘org.springframework.boot’

jar {
baseName = 'PosWebService’
version = ‘0.0.1-SNAPSHOT’
}

// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
flatDir { dirs ‘lib’ }
}

dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api ‘org.apache.commons:commons-math3:3.6.1’

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:22.0'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'org.springframework.boot:spring-boot-starter-web'

}