Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find method bootJar() for arguments

Tags:

spring-boot

While building the gradle project I am getting below error- FAILURE: Build failed with an exception.

  • Where: Build file '/Users/vdubey/Documents/microservices/workspace/Promo-Service/build.gradle' line: 30

  • What went wrong: A problem occurred evaluating root project 'Promo-Service'.

    Could not find method bootJar() for arguments [build_3jq74tz48uic808y18txabjvx$_run_closure1@5c4aa147] on root project 'Promo-Service' of type org.gradle.api.Project.

  • 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

Any clue why it is failing?

like image 962
Vishnu Dubey Avatar asked Apr 12 '18 13:04

Vishnu Dubey


People also ask

What is bootJar in gradle?

bootJar on the other hand is a specific task added by Spring Boot Gradle plugin that, when the java plugin is present, attaches itself to the assemble lifecycle task. The assemble task is automatically configured to depend upon the bootJar task so running assemble (or build ) will also run the bootJar task.

What is org Springframework Boot Spring Boot Gradle plugin?

The Spring Boot Gradle Plugin provides Spring Boot support in Gradle. It allows you to package executable jar or war archives, run Spring Boot applications, and use the dependency management provided by spring-boot-dependencies .

What is plain jar?

app-plain. jar is the archive produced by the jar task. This is a plain or standard jar file that contains only the module's classes and resources. You can learn a bit more about this in the documentation for Spring Boot's Gradle plugin.

What is Spring Boot dependency management?

Dependency is nothing but a 'Library' that provides specific functionality that we can use in our application. In Spring-Boot, Dependency Management and Auto-Configuration work simultaneously.


1 Answers

Consider checking the presence of gradle plugin for Spring Boot: https://plugins.gradle.org/plugin/org.springframework.boot

For Gradle 2.1 and later:

plugins {
  id "org.springframework.boot" version "2.1.0.RELEASE"
}

For older Gradle versions:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "org.springframework.boot:spring-boot-gradle-plugin:2.1.0.RELEASE"
  }
}

apply plugin: "org.springframework.boot"
like image 64
leo9r Avatar answered Oct 15 '22 09:10

leo9r