akhikhl / gretty

Advanced gradle plugin for running web-apps on jetty and tomcat.
MIT License
657 stars 173 forks source link

Could not find property 'main' on task ':run'. #247

Open satyajitn opened 8 years ago

satyajitn commented 8 years ago

trying to run gretty with JDK 1.8 for spring boot project

build.gradle

`buildscript { ext { springBootVersion = '1.3.3.RELEASE'

}
repositories {
    mavenCentral()
    jcenter()
    }
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
    classpath 'org.akhikhl.gretty:gretty:+'
}

}

apply plugin: 'java' apply plugin: 'eclipse-wtp' apply plugin: 'spring-boot' apply plugin: 'war' apply plugin: 'jacoco' apply plugin: 'org.akhikhl.gretty'

war { baseName = 'blogentryservice' version = '0.1' } sourceCompatibility = 1.8 targetCompatibility = 1.8

repositories { mavenCentral() jcenter()

}

configurations { providedRuntime }

dependencies { compile('org.springframework.boot:spring-boot-starter-web') compile('org.springframework.boot:spring-boot-starter-actuator') compile ('org.springframework.hateoas:spring-hateoas') compile('org.springframework.boot:spring-boot-starter-data-jpa') runtime('org.hsqldb:hsqldb') providedRuntime('org.springframework.boot:spring-boot-starter-tomcat') testCompile('org.springframework.boot:spring-boot-starter-test') compile ('io.springfox:springfox-swagger2:2.4.0') compile ('io.springfox:springfox-swagger-ui:2.4.0') testCompile ('com.jayway.jsonpath:json-path') testCompile ('com.jayway.jsonpath:json-path-assert') }

eclipse { classpath { containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' } }

task wrapper(type: Wrapper) { gradleVersion = '2.11' }

test { systemProperties 'property': 'value' include '/Test.' exclude '/IntegrationTest.' }

configurations { integTestCompile.extendsFrom testCompile integTestRuntime.extendsFrom testRuntime } sourceSets { integTest { java { compileClasspath += main.output + test.output runtimeClasspath += main.output + test.output srcDir file('src/integTest/java') } resources.srcDir file('src/integTest/resources') } }

task integTest (type:Test){ description = 'Runs the integration tests.' group='verification' testClassesDir = sourceSets.integTest.output.classesDir classpath = sourceSets.integTest.runtimeClasspath reports.html.destination = file("$reports.html.destination/integration") include '_/_IntegrationTest.' reports.junitXml.destination = file("$reports.junitXml.destination/integration")

} check.dependsOn integTest integTest.mustRunAfter test

gretty { //servletContainer = 'tomcat8' servletContainer = 'jetty9' contextPath = 'rest-service' port = 8084 httpsEnabled = true integrationTestTask = 'integTest' springBoot = true }

ext { integrationTestContainers = ['jetty9', 'tomcat8'] }

jacoco { toolVersion = "0.7.6" reportsDir = file("$buildDir/reports/jacoco") }

jacocoTestReport { reports { xml.enabled = true html.enabled = true } }

task jacocoIntegrationTestReport(type:JacocoReport) { sourceSets sourceSets.main executionData integTest }

`

I am getting following error

Executing task ':findMainClass' (up-to-date check took 0.0 secs) due to: Task has not declared any outputs. :findMainClass FAILED :findMainClass (Thread[main,5,main]) completed. Took 0.032 secs.

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 23.281 secs Stopped 0 compiler daemon(s).

saladinkzn commented 8 years ago

Which task are you using? You're supposed to use :appRun task instead of :run

2016-03-16 6:58 GMT+03:00 satya notifications@github.com:

trying to run gretty with JDK 1.8 for spring boot project

`buildscript { ext { springBootVersion = '1.3.3.RELEASE'

} repositories { mavenCentral() jcenter() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath 'org.akhikhl.gretty:gretty:+' }

}

apply plugin: 'java' apply plugin: 'eclipse-wtp' apply plugin: 'spring-boot' apply plugin: 'war' apply plugin: 'jacoco' apply plugin: 'org.akhikhl.gretty'

war { baseName = 'blogentryservice' version = '0.1' } sourceCompatibility = 1.8 targetCompatibility = 1.8

repositories { mavenCentral() jcenter()

}

configurations { providedRuntime }

dependencies { compile('org.springframework.boot:spring-boot-starter-web') compile('org.springframework.boot:spring-boot-starter-actuator') compile ('org.springframework.hateoas:spring-hateoas') compile('org.springframework.boot:spring-boot-starter-data-jpa') runtime('org.hsqldb:hsqldb') providedRuntime('org.springframework.boot:spring-boot-starter-tomcat') testCompile('org.springframework.boot:spring-boot-starter-test') compile ('io.springfox:springfox-swagger2:2.4.0') compile ('io.springfox:springfox-swagger-ui:2.4.0') testCompile ('com.jayway.jsonpath:json-path') testCompile ('com.jayway.jsonpath:json-path-assert') }

eclipse { classpath { containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' } }

task wrapper(type: Wrapper) { gradleVersion = '2.11' }

test { systemProperties 'property': 'value' include ' /Test.' exclude '/IntegrationTest.' }

configurations { integTestCompile.extendsFrom testCompile integTestRuntime.extendsFrom testRuntime } sourceSets { integTest { java { compileClasspath += main.output + test.output runtimeClasspath += main.output + test.output srcDir file('src/integTest/java') } resources.srcDir file('src/integTest/resources') } }

task integTest (type:Test){ description = 'Runs the integration tests.' group='verification' testClassesDir = sourceSets.integTest.output.classesDir classpath = sourceSets.integTest.runtimeClasspath reports.html.destination = file("$reports.html.destination/integration") include '_/_IntegrationTest.' reports.junitXml.destination = file("$reports.junitXml.destination/integration")

} check.dependsOn integTest integTest.mustRunAfter test

gretty { //servletContainer = 'tomcat8' servletContainer = 'jetty9' contextPath = 'rest-service' port = 8084 httpsEnabled = true integrationTestTask = 'integTest' springBoot = true }

ext { integrationTestContainers = ['jetty9', 'tomcat8'] }

jacoco { toolVersion = "0.7.6" reportsDir = file("$buildDir/reports/jacoco") }

jacocoTestReport { reports { xml.enabled = true html.enabled = true } }

task jacocoIntegrationTestReport(type:JacocoReport) { sourceSets sourceSets.main executionData integTest } `

Executing task ':findMainClass' (up-to-date check took 0.0 secs) due to: Task has not declared any outputs. :findMainClass FAILED :findMainClass (Thread[main,5,main]) completed. Took 0.032 secs.

FAILURE: Build failed with an exception.

-

What went wrong: Execution failed for task ':findMainClass'.

Could not find property 'main' on task ':run'.

-

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

BUILD FAILED

Total time: 23.281 secs Stopped 0 compiler daemon(s).

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/akhikhl/gretty/issues/247

satyajitn commented 8 years ago

I am running Gradle clean build when above error showed up

akhikhl commented 8 years ago

Resolved with https://github.com/akhikhl/gretty/pull/279. Will be delivered with Gretty 1.4.0.