--- /dev/null
+sourceSets {
+ integTest {
+ compileClasspath += main.output + test.output
+ runtimeClasspath += main.output + test.output
+ }
+}
+
+configurations {
+ integTestCompile.extendsFrom testCompile
+ integTestRuntime.extendsFrom testRuntime
+}
+
+
+task integTest(type: Test) {
+ // dependsOn startApp
+ // finalizedBy stopApp
+ description = 'Runs integration tests';
+ group = 'verification';
+
+ testClassesDir = sourceSets.integTest.output.classesDir
+ classpath = sourceSets.integTest.runtimeClasspath
+
+ testLogging {
+ events "PASSED", "FAILED", "SKIPPED"
+ }
+
+ jacoco {
+ append = false
+ destinationFile = file("$buildDir/jacoco/jacoco-it.exec")
+ classDumpFile = file("$buildDir/jacoco/classpathIntegdumps")
+ }
+
+ // mustRunAfter test
+}
+
+project.tasks.check.dependsOn(integTest)
--- /dev/null
+test {
+ testLogging {
+ events "PASSED", "FAILED", "SKIPPED"
+ }
+
+ jacoco {
+ append = false
+ destinationFile = file("$buildDir/jacoco/jacoco.exec")
+ classDumpFile = file("$buildDir/jacoco/classpathdumps")
+ }
+}
+
--- /dev/null
+subprojects {
+ apply plugin: 'java'
+ apply plugin: 'idea'
+ apply plugin: 'jacoco'
+ apply plugin: 'eclipse'
+ apply plugin: 'idea'
+
+ group 'de.spring.jpa'
+ version '1.0-SNAPSHOT'
+
+ targetCompatibility = 1.8
+ sourceCompatibility = 1.8
+
+
+ repositories {
+ mavenCentral()
+ maven { url 'https://dl.bintray.com/palantir/releases' }
+ }
+
+ buildscript {
+ repositories {
+ mavenCentral()
+ maven { url 'https://plugins.gradle.org/m2/' }
+ }
+ }
+
+ jar {
+ manifest {
+ attributes 'Implementation-Title': 'Spring JPA Persistence, gradle example', 'Implementation-Version': version
+ }
+ }
+
+ apply plugin: 'jacoco'
+
+ apply from: "$rootProject.projectDir/build-test.gradle"
+ apply from: "$rootProject.projectDir/build-integTest.gradle"
+
+ jacoco {
+ toolVersion = '0.7.6.201602180812'
+ reportsDir = file("$buildDir/reports/jacoco")
+ }
+
+ jacocoTestReport {
+ reports {
+ xml.enabled false
+ csv.enabled false
+ html.destination "${buildDir}/jacoco/"
+ }
+ }
+
+}
+
--- /dev/null
+include 'spring-jpa-persistence'
+++ /dev/null
-sourceSets {
- integTest {
- compileClasspath += main.output + test.output
- runtimeClasspath += main.output + test.output
- }
-}
-
-configurations {
- integTestCompile.extendsFrom testCompile
- integTestRuntime.extendsFrom testRuntime
-}
-
-
-task integTest(type: Test) {
- // dependsOn startApp
- // finalizedBy stopApp
- description = 'Runs integration tests';
- group = 'verification';
-
- testClassesDir = sourceSets.integTest.output.classesDir
- classpath = sourceSets.integTest.runtimeClasspath
-
- testLogging {
- events "PASSED", "FAILED", "SKIPPED"
- }
-
- jacoco {
- append = false
- destinationFile = file("$buildDir/jacoco/jacoco-it.exec")
- classDumpFile = file("$buildDir/jacoco/classpathIntegdumps")
- }
-
- // mustRunAfter test
-}
-
-integTest.doFirst {
- // It is required in order to run data bases in random ports.
- // We need it for running tests from IDE and from command console but
- // also it will be required by systems like Travis where we do not control
- // the available ports.
- def mysqlInfo = dockerCompose.servicesInfos.mysql
- systemProperty 'DATABASE_PORT', mysqlInfo.ports[3306]
-}
-
-dockerCompose.isRequiredBy(integTest)
-dockerCompose {
- useComposeFiles = ['src/integTest/resources/docker/docker-compose.yml']
- captureContainersOutput = false
- stopContainers = true
- removeContainers = true
- buildBeforeUp = false
-}
-
-project.tasks.check.dependsOn(integTest)
+++ /dev/null
-test {
- testLogging {
- events "PASSED", "FAILED", "SKIPPED"
- }
-
- jacoco {
- append = false
- destinationFile = file("$buildDir/jacoco/jacoco.exec")
- classDumpFile = file("$buildDir/jacoco/classpathdumps")
- }
-}
-
-group 'de.spring.jpa'
-version '1.0-SNAPSHOT'
-
-
buildscript {
- repositories {
- mavenCentral()
- maven { url 'https://plugins.gradle.org/m2/' }
- }
+
dependencies {
classpath 'gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7'
classpath 'com.avast.gradle:docker-compose-gradle-plugin:0.3.16'
}
}
-apply plugin: 'java'
-apply plugin: 'eclipse'
-apply plugin: 'idea'
-apply plugin: 'jacoco'
apply plugin: 'com.ewerk.gradle.plugins.querydsl'
apply plugin: 'docker-compose'
-apply from: 'build-test.gradle'
-apply from: 'build-integTest.gradle'
-
-
-targetCompatibility = 1.8
-sourceCompatibility = 1.8
-
-
-
-repositories {
- mavenCentral()
- maven { url 'https://dl.bintray.com/palantir/releases' }
-}
-
-eclipse {
- classpath {
- downloadJavadoc = true
- downloadSources = true
- }
-}
-
dependencies {
// 1/3 Required dependency for log4j 2 with slf4j: binding between log4j2 and slf4j
compile('org.apache.logging.log4j:log4j-slf4j-impl:2.7')
jpa = true
}
-
-jar {
- manifest {
- attributes 'Implementation-Title': 'Spring JPA Persistence, gradle example', 'Implementation-Version': version
- }
-}
-
-jacoco {
- toolVersion = '0.7.6.201602180812'
- reportsDir = file("$buildDir/reports/jacoco")
+integTest.doFirst {
+ // It is required in order to run data bases in random ports.
+ // We need it for running tests from IDE and from command console but
+ // also it will be required by systems like Travis where we do not control
+ // the available ports.
+ def mysqlInfo = dockerCompose.servicesInfos.mysql
+ systemProperty 'DATABASE_PORT', mysqlInfo.ports[3306]
}
-jacocoTestReport {
- reports {
- xml.enabled false
- csv.enabled false
- html.destination "${buildDir}/jacoco/"
- }
+dockerCompose.isRequiredBy(integTest)
+dockerCompose {
+ useComposeFiles = ['src/integTest/resources/docker/docker-compose.yml']
+ captureContainersOutput = false
+ stopContainers = true
+ removeContainers = true
+ buildBeforeUp = false
}
+++ /dev/null
-rootProject.name = 'gradle-spring-jpa-persistence'