buildscript { repositories { maven { url 'https://repo.spring.io/plugins-release' } } dependencies { classpath 'io.spring.gradle:dependency-management-plugin:1.0.0.RC2' classpath 'io.spring.gradle:spring-io-plugin:0.0.6.RELEASE' } } plugins { id 'java' id 'eclipse' id 'idea' id 'jacoco' id 'org.sonarqube' version '2.1' } apply from: "${rootProject.projectDir}/publish-maven.gradle" description = 'Spring Integration Flow' sourceSets { test { resources { srcDirs = ['src/test/resources', 'src/test/java'] } } } if (project.hasProperty('platformVersion')) { apply plugin: 'spring-io' repositories { maven { url "https://repo.spring.io/libs-snapshot" } } dependencyManagement { springIoTestRuntime { imports { mavenBom "io.spring.platform:platform-bom:${platformVersion}" } } } } group = 'org.springframework.integration' repositories { maven { url 'https://repo.spring.io/libs-snapshot' } } compileJava { sourceCompatibility = 1.8 targetCompatibility = 1.8 } ext { commonsLangVersion = '2.6' log4jVersion = '2.7' springIntegrationVersion = '5.0.13.BUILD-SNAPSHOT' linkHomepage = 'https://github.com/spring-projects/spring-integration-extensions' linkCi = 'https://build.spring.io/browse/INTEXT' linkIssue = 'https://jira.spring.io/browse/INTEXT' linkScmUrl = 'https://github.com/spring-projects/spring-integration-extensions' linkScmConnection = 'https://github.com/spring-projects/spring-integration-extensions.git' linkScmDevConnection = 'git@github.com:spring-projects/spring-integration-extensions.git' shortName = 'flow' } // See https://www.gradle.org/docs/current/userguide/dependency_management.html#sub:configurations // and https://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ConfigurationContainer.html configurations { jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo } dependencies { compile "org.springframework.integration:spring-integration-core:$springIntegrationVersion" compile "commons-lang:commons-lang:$commonsLangVersion" testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion" testCompile "org.springframework.integration:spring-integration-groovy:$springIntegrationVersion" testCompile "org.springframework.integration:spring-integration-jmx:$springIntegrationVersion" testCompile "org.apache.logging.log4j:log4j-core:$log4jVersion" testRuntime "org.apache.logging.log4j:log4j-jcl:$log4jVersion" } eclipse { project { natures += 'org.springframework.ide.eclipse.core.springnature' } } jacoco { toolVersion = "0.7.8" } // enable all compiler warnings; individual projects may customize further [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options'] test { // suppress all console output during testing unless running `gradle -i` logging.captureStandardOutput(LogLevel.INFO) jacoco { append = false destinationFile = file("$buildDir/jacoco.exec") } } jacocoTestReport { reports { xml.enabled false csv.enabled false html.destination "${buildDir}/reports/jacoco/html" } } build.dependsOn jacocoTestReport task sourcesJar(type: Jar) { classifier = 'sources' from sourceSets.main.allJava } task javadocJar(type: Jar) { classifier = 'javadoc' from javadoc } artifacts { archives sourcesJar archives javadocJar } sonarqube { properties { property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec" property "sonar.links.homepage", linkHomepage property "sonar.links.ci", linkCi property "sonar.links.issue", linkIssue property "sonar.links.scm", linkScmUrl property "sonar.links.scm_dev", linkScmDevConnection property "sonar.java.coveragePlugin", "jacoco" } } task api(type: Javadoc) { group = 'Documentation' description = 'Generates aggregated Javadoc API documentation.' title = "${rootProject.description} ${version} API" options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED options.author = true options.header = rootProject.description options.overview = 'src/api/overview.html' source subprojects.collect { project -> project.sourceSets.main.allJava } destinationDir = new File(buildDir, "api") classpath = files(subprojects.collect { project -> project.sourceSets.main.compileClasspath }) } task schemaZip(type: Zip) { description = "Builds -${classifier} archive containing all " + "XSDs for deployment at static.springframework.org/schema." group = 'Distribution' classifier = 'schema' duplicatesStrategy = 'exclude' def Properties schemas = new Properties(); project.sourceSets.main.resources.find { it.path.endsWith("META-INF${File.separator}spring.schemas") }?.withInputStream { schemas.load(it) } for (def key : schemas.keySet()) { File xsdFile = project.sourceSets.main.resources.find { it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key)) } assert xsdFile != null into("integration/${shortName}") { from xsdFile.path } } } task distZip(type: Zip, dependsOn: schemaZip) { group = 'Distribution' classifier = 'dist' description = "Builds -${classifier} archive, containing all jars and docs, " + "suitable for community download page." ext.baseDir = "${project.name}-${project.version}"; from('src/dist') { include 'readme.txt' include 'license.txt' include 'notice.txt' into "${baseDir}" } from(zipTree(schemaZip.archivePath)) { into "${baseDir}/schema" } into("${baseDir}/libs") { from jar from sourcesJar from javadocJar } } // Create an optional "with dependencies" distribution. // Not published by default; only for use when building from source. task depsZip(type: Zip, dependsOn: distZip) { zipTask -> group = 'Distribution' classifier = 'dist-with-deps' description = "Builds -${classifier} archive, containing everything " + "in the -${distZip.classifier} archive plus all dependencies." from zipTree(distZip.archivePath) gradle.taskGraph.whenReady { taskGraph -> if (taskGraph.hasTask(":${zipTask.name}")) { def projectNames = rootProject.subprojects*.name def artifacts = new HashSet() subprojects.each { subproject -> subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact -> def dependency = artifact.moduleVersion.id if (!projectNames.contains(dependency.name)) { artifacts << artifact.file } } } zipTask.from(artifacts) { into "${distZip.baseDir}/deps" } } } } artifacts { archives distZip archives schemaZip } task dist(dependsOn: assemble) { group = 'Distribution' description = 'Builds -dist, -docs and -schema distribution archives.' } defaultTasks 'build'