project(':spring-restdocs') { ext { jacksonVersion = '2.3.4' jacocoVersion = '0.7.2.201409121644' junitVersion = '4.11' servletApiVersion = '3.1.0' springVersion = '4.1.4.RELEASE' mockitoVersion = '1.10.19' } group = 'org.springframework.restdocs' apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'maven' apply plugin: 'sonar-runner' sonarRunner { sonarProperties { property 'sonar.jacoco.reportPath', "${buildDir.name}/jacoco.exec" property 'sonar.java.coveragePlugin', 'jacoco' property 'sonar.links.ci', 'https://build.spring.io/browse/SRD' property 'sonar.links.homepage', 'https://github.com/spring-projects/spring-restdocs' property 'sonar.links.issue', 'https://github.com/spring-projects/spring-restdocs' property 'sonar.links.scm', 'https://github.com/spring-projects/spring-restdocs' } } configurations { jacoco } sourceCompatibility = 1.7 targetCompatibility = 1.7 repositories { jcenter() } task sourcesJar(type: Jar) { classifier = 'sources' from project.sourceSets.main.allSource } task javadocJar(type: Jar) { classifier = "javadoc" from javadoc } artifacts { archives sourcesJar archives javadocJar } eclipseJdt.onlyIf { false } cleanEclipseJdt.onlyIf { false } dependencies { compile "junit:junit:$junitVersion" compile "org.springframework:spring-test:$springVersion" compile "org.springframework:spring-web:$springVersion" compile "javax.servlet:javax.servlet-api:$servletApiVersion" compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion" jacoco "org.jacoco:org.jacoco.agent:$jacocoVersion:runtime" testCompile "org.springframework:spring-webmvc:$springVersion" testCompile "org.mockito:mockito-core:$mockitoVersion" } test { jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=org.springframework.restdocs.*" } } task buildSamples { description = 'Assembles and tests the sample projects using both Maven and Gradle' group = 'Build' dependsOn 'buildMavenSamples' dependsOn 'buildGradleSamples' } task buildMavenSamples { dependsOn 'buildRestNotesSpringHateoasSampleWithMaven' dependsOn 'buildRestNotesSpringDataRestSampleWithMaven' } task buildGradleSamples { dependsOn 'buildRestNotesSpringHateoasSampleWithGradle' dependsOn 'buildRestNotesSpringDataRestSampleWithGradle' } task buildRestNotesSpringHateoasSampleWithGradle(type: GradleBuild) { dependsOn 'spring-restdocs:install' dir = 'samples/rest-notes-spring-hateoas' tasks = ['clean', 'build'] } task buildRestNotesSpringDataRestSampleWithGradle(type: GradleBuild) { dependsOn 'spring-restdocs:install' dir = 'samples/rest-notes-spring-data-rest' tasks = ['clean', 'build'] } task buildRestNotesSpringHateoasSampleWithMaven(type: Exec) { dependsOn 'spring-restdocs:install' workingDir 'samples/rest-notes-spring-hateoas' def suffix = File.separatorChar == '/' ? '' : '.bat' commandLine "${System.env.MAVEN_HOME}/bin/mvn${suffix}", 'clean', 'package' } task buildRestNotesSpringDataRestSampleWithMaven(type: Exec) { dependsOn 'spring-restdocs:install' workingDir 'samples/rest-notes-spring-data-rest' def suffix = File.separatorChar == '/' ? '' : '.bat' commandLine "${System.env.MAVEN_HOME}/bin/mvn${suffix}", 'clean', 'package' } wrapper { gradleVersion = '2.2' }