Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

343
Views
org.gradle.initialization.DefaultSettings_Decorated cannot be cast to org.gradle.api.internal.project.ProjectInternal

I tried to create spring boot application:

I selected components I need from https://start.spring.io/

Now I want to build the application and it fall downs:

FAILURE: Build failed with an exception.

* Where: 
Settings file 'D:\objectsharingsystem\settings.gradle' line: 2

* What went wrong:
A problem occurred evaluating settings 'object-sharing-system'.
> Failed to apply plugin [id 'org.gradle.java']
   > org.gradle.initialization.DefaultSettings_Decorated cannot be cast to org.gradle.api.internal.project.ProjectInternal

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

BUILD FAILED

settings.gradle:

rootProject.name = 'object-sharing-system'
apply plugin: 'java'
compileJava {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}

build.gradle:

buildscript {
    ext {
        springBootVersion = '2.0.0.BUILD-SNAPSHOT'
    }
    repositories {
        mavenCentral()
        maven { url "https://repo.spring.io/snapshot" }
        maven { url "https://repo.spring.io/milestone" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'

version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/milestone" }
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-jdbc')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('org.springframework.boot:spring-boot-starter-validation')
    compile('org.springframework.boot:spring-boot-starter-web')
    runtime('com.microsoft.sqlserver:mssql-jdbc')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

Please help to find mistake.

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

settings.gradle can not handle application of Project level plugin.

Remove apply plugin and compileJava from settings.gradle. You already have your sourceCompatibility set in build.gradle

about 4 years ago · Santiago Trujillo Report

0

See here where it says

method calls within the settings file is delegated to a settings object. Look at the Settings class in the API documentation for more information.

Unlike build.gradle, the apply method in settings.gradle expects a Plugin<Settings> and not a Plugin<Project>. The java plugin is a Plugin<Project> and can't be applied like this in settings.gradle

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!