Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Spring Basics Spring Components and Configuring Our App Adding a Spring Configuration File

Rhett Herring
Rhett Herring
11,021 Points

Execution failed for task ':findMainClass'.

When using bootrun from Gradle window I get the error "Execution failed for task ':findMainClass'."

When I right click on AppConfig class and choose run... everything works as expected.

How can I set the path for Gradle to run the AppConfig.class as Main...

1 Answer

Rhett Herring
Rhett Herring
11,021 Points
used this as my build file:

    plugins {
    id 'java'
    id 'idea'
    id 'eclipse'
    id 'org.springframework.boot' version '2.1.7.RELEASE'

group 'com.teamtreehouse'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-web:2.1.7.RELEASE'

Thank you!