0

I am just starting out with Spring and have successfully setup and am running the RESTful tutorial using gradle buildship within Eclipse.

https://spring.io/guides/gs/rest-service/#initial

However, one thing I cannot get working within Eclipse is it says you can run the application from gradle rather than the jar directly by the command:

gradle bootRun

but bootRun is not a task created by the gradle script, only 'run' (which does not work). All the other entries, like 'build', etc. are there.

It's not a big deal as I can run the jar from the command line but I'd like to run it from within Eclipse (I do not have gradle installed either, just buildship).

thanks.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.3.RELEASE")
    }
}

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

jar {
    baseName = 'gs-rest-service'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile('org.springframework.boot:spring-boot-starter-test')
}
Neil Walker
  • 6,400
  • 14
  • 57
  • 86

1 Answers1

0

You don't need 'gradle bootRun'

Just run that as a main method:

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135