Running a Spring Boot app using ./gradlew appRun












0















I'm using Spring Boot for a school project as a personal choice but the automated tester uses ./gradlew appRun to start the whole thing up.



This was fine before when they were using servlets but after moving to Spring Boot, I'm getting several exceptions when trying to do so.



Execution failed for task ':appRun'.
Could not get unknown property 'mainClass' for object of type org.springframework.boot.gradle.dsl.SpringBootExtension.


and this is my current build.gradle.



buildscript {
ext {
springBootVersion = '2.1.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath "gradle.plugin.org.akhikhl.gretty:gretty:2.0.0"
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}

plugins {
id 'org.gretty' version '2.2.0'
id 'war'
}
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: "org.akhikhl.gretty"
apply plugin: 'application'

sourceCompatibility = 8

repositories {
mavenCentral()
jcenter()
}

dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
runtimeOnly('com.h2database:h2')
runtimeOnly('mysql:mysql-connector-java')
runtimeOnly('org.hsqldb:hsqldb')
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.7'
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile group: 'org.apache.ibatis', name: 'ibatis-core', version: '3.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
compile group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4'
compile group: 'org.apache.ibatis', name: 'ibatis-core', version: '3.0'
compile group: 'org.gretty', name: 'gretty-runner-jetty94', version: '2.2.0'
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
providedRuntime ('org.springframework.boot:spring-boot-starter-tomcat')
runtimeOnly('mysql:mysql-connector-java')
compileOnly('org.projectlombok:lombok')
testImplementation('org.springframework.boot:spring-boot-starter-test')
}

gretty {
contextPath = '/'
}


This all works fine when using ./gradlew bootRun but that doesn't pass the automated tester.



Is there a way to make running ./gradlew appRun start up the SpringBoot main class similarly or directly ./gradlew bootRun?










share|improve this question



























    0















    I'm using Spring Boot for a school project as a personal choice but the automated tester uses ./gradlew appRun to start the whole thing up.



    This was fine before when they were using servlets but after moving to Spring Boot, I'm getting several exceptions when trying to do so.



    Execution failed for task ':appRun'.
    Could not get unknown property 'mainClass' for object of type org.springframework.boot.gradle.dsl.SpringBootExtension.


    and this is my current build.gradle.



    buildscript {
    ext {
    springBootVersion = '2.1.0.RELEASE'
    }
    repositories {
    mavenCentral()
    }
    dependencies {
    classpath "gradle.plugin.org.akhikhl.gretty:gretty:2.0.0"
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
    }

    plugins {
    id 'org.gretty' version '2.2.0'
    id 'war'
    }
    apply plugin: 'groovy'
    apply plugin: 'java'
    apply plugin: 'eclipse'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'
    apply plugin: "org.akhikhl.gretty"
    apply plugin: 'application'

    sourceCompatibility = 8

    repositories {
    mavenCentral()
    jcenter()
    }

    dependencies {
    implementation('org.springframework.boot:spring-boot-starter-web')
    runtimeOnly('com.h2database:h2')
    runtimeOnly('mysql:mysql-connector-java')
    runtimeOnly('org.hsqldb:hsqldb')
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.7'
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile group: 'org.apache.ibatis', name: 'ibatis-core', version: '3.0'
    compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
    compile group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4'
    compile group: 'org.apache.ibatis', name: 'ibatis-core', version: '3.0'
    compile group: 'org.gretty', name: 'gretty-runner-jetty94', version: '2.2.0'
    compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
    providedRuntime ('org.springframework.boot:spring-boot-starter-tomcat')
    runtimeOnly('mysql:mysql-connector-java')
    compileOnly('org.projectlombok:lombok')
    testImplementation('org.springframework.boot:spring-boot-starter-test')
    }

    gretty {
    contextPath = '/'
    }


    This all works fine when using ./gradlew bootRun but that doesn't pass the automated tester.



    Is there a way to make running ./gradlew appRun start up the SpringBoot main class similarly or directly ./gradlew bootRun?










    share|improve this question

























      0












      0








      0








      I'm using Spring Boot for a school project as a personal choice but the automated tester uses ./gradlew appRun to start the whole thing up.



      This was fine before when they were using servlets but after moving to Spring Boot, I'm getting several exceptions when trying to do so.



      Execution failed for task ':appRun'.
      Could not get unknown property 'mainClass' for object of type org.springframework.boot.gradle.dsl.SpringBootExtension.


      and this is my current build.gradle.



      buildscript {
      ext {
      springBootVersion = '2.1.0.RELEASE'
      }
      repositories {
      mavenCentral()
      }
      dependencies {
      classpath "gradle.plugin.org.akhikhl.gretty:gretty:2.0.0"
      classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
      }
      }

      plugins {
      id 'org.gretty' version '2.2.0'
      id 'war'
      }
      apply plugin: 'groovy'
      apply plugin: 'java'
      apply plugin: 'eclipse'
      apply plugin: 'org.springframework.boot'
      apply plugin: 'io.spring.dependency-management'
      apply plugin: "org.akhikhl.gretty"
      apply plugin: 'application'

      sourceCompatibility = 8

      repositories {
      mavenCentral()
      jcenter()
      }

      dependencies {
      implementation('org.springframework.boot:spring-boot-starter-web')
      runtimeOnly('com.h2database:h2')
      runtimeOnly('mysql:mysql-connector-java')
      runtimeOnly('org.hsqldb:hsqldb')
      compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.7'
      compile("org.springframework.boot:spring-boot-starter-data-jpa")
      compile group: 'org.apache.ibatis', name: 'ibatis-core', version: '3.0'
      compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
      compile group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4'
      compile group: 'org.apache.ibatis', name: 'ibatis-core', version: '3.0'
      compile group: 'org.gretty', name: 'gretty-runner-jetty94', version: '2.2.0'
      compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
      providedRuntime ('org.springframework.boot:spring-boot-starter-tomcat')
      runtimeOnly('mysql:mysql-connector-java')
      compileOnly('org.projectlombok:lombok')
      testImplementation('org.springframework.boot:spring-boot-starter-test')
      }

      gretty {
      contextPath = '/'
      }


      This all works fine when using ./gradlew bootRun but that doesn't pass the automated tester.



      Is there a way to make running ./gradlew appRun start up the SpringBoot main class similarly or directly ./gradlew bootRun?










      share|improve this question














      I'm using Spring Boot for a school project as a personal choice but the automated tester uses ./gradlew appRun to start the whole thing up.



      This was fine before when they were using servlets but after moving to Spring Boot, I'm getting several exceptions when trying to do so.



      Execution failed for task ':appRun'.
      Could not get unknown property 'mainClass' for object of type org.springframework.boot.gradle.dsl.SpringBootExtension.


      and this is my current build.gradle.



      buildscript {
      ext {
      springBootVersion = '2.1.0.RELEASE'
      }
      repositories {
      mavenCentral()
      }
      dependencies {
      classpath "gradle.plugin.org.akhikhl.gretty:gretty:2.0.0"
      classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
      }
      }

      plugins {
      id 'org.gretty' version '2.2.0'
      id 'war'
      }
      apply plugin: 'groovy'
      apply plugin: 'java'
      apply plugin: 'eclipse'
      apply plugin: 'org.springframework.boot'
      apply plugin: 'io.spring.dependency-management'
      apply plugin: "org.akhikhl.gretty"
      apply plugin: 'application'

      sourceCompatibility = 8

      repositories {
      mavenCentral()
      jcenter()
      }

      dependencies {
      implementation('org.springframework.boot:spring-boot-starter-web')
      runtimeOnly('com.h2database:h2')
      runtimeOnly('mysql:mysql-connector-java')
      runtimeOnly('org.hsqldb:hsqldb')
      compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.7'
      compile("org.springframework.boot:spring-boot-starter-data-jpa")
      compile group: 'org.apache.ibatis', name: 'ibatis-core', version: '3.0'
      compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
      compile group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4'
      compile group: 'org.apache.ibatis', name: 'ibatis-core', version: '3.0'
      compile group: 'org.gretty', name: 'gretty-runner-jetty94', version: '2.2.0'
      compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
      providedRuntime ('org.springframework.boot:spring-boot-starter-tomcat')
      runtimeOnly('mysql:mysql-connector-java')
      compileOnly('org.projectlombok:lombok')
      testImplementation('org.springframework.boot:spring-boot-starter-test')
      }

      gretty {
      contextPath = '/'
      }


      This all works fine when using ./gradlew bootRun but that doesn't pass the automated tester.



      Is there a way to make running ./gradlew appRun start up the SpringBoot main class similarly or directly ./gradlew bootRun?







      java spring spring-boot






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 19:36









      karlehkarleh

      248




      248
























          1 Answer
          1






          active

          oldest

          votes


















          1














          This is a gretty question. Add this line to gretty config:



          gretty {
          contextPath = '/'
          springBoot = true
          }


          Here's the doc: http://akhikhl.github.io/gretty-doc/spring-boot-support.html






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419391%2frunning-a-spring-boot-app-using-gradlew-apprun%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            This is a gretty question. Add this line to gretty config:



            gretty {
            contextPath = '/'
            springBoot = true
            }


            Here's the doc: http://akhikhl.github.io/gretty-doc/spring-boot-support.html






            share|improve this answer




























              1














              This is a gretty question. Add this line to gretty config:



              gretty {
              contextPath = '/'
              springBoot = true
              }


              Here's the doc: http://akhikhl.github.io/gretty-doc/spring-boot-support.html






              share|improve this answer


























                1












                1








                1







                This is a gretty question. Add this line to gretty config:



                gretty {
                contextPath = '/'
                springBoot = true
                }


                Here's the doc: http://akhikhl.github.io/gretty-doc/spring-boot-support.html






                share|improve this answer













                This is a gretty question. Add this line to gretty config:



                gretty {
                contextPath = '/'
                springBoot = true
                }


                Here's the doc: http://akhikhl.github.io/gretty-doc/spring-boot-support.html







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 21 '18 at 20:00









                RaphaelRaphael

                1,39011020




                1,39011020






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419391%2frunning-a-spring-boot-app-using-gradlew-apprun%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Ottavio Pratesi

                    Tricia Helfer

                    15 giugno