diff --git a/build.gradle b/build.gradle index 07685abf..af7db4e4 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,7 @@ * limitations under the License. */ +import org.springframework.build.Version // ----------------------------------------------------------------------------- // Main gradle build file for Spring AMQP @@ -24,20 +25,30 @@ // or from jars on 'buildscript' classpath (in our case, it's all buildSrc) // sources in buildSrc are compiled and placed on the classpath automatically // -// @author cbeams +// @author Chris Beams // ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// Configuration for the root project +// ----------------------------------------------------------------------------- +// used for artifact names, building doc upload urls, etc. +description = 'Spring AMQP' +abbreviation = 'AMQP' + +apply plugin: 'base' +apply plugin: 'idea' + +def buildSrcDir = "$rootDir/buildSrc" +apply from: "$buildSrcDir/wrapper.gradle" +apply from: "$buildSrcDir/maven-root-pom.gradle" + + // ----------------------------------------------------------------------------- // Configuration for all projects including this one (the root project) // // @see settings.gradle for list of all subprojects // ----------------------------------------------------------------------------- - -apply from: "$rootDir/gradle/version.gradle" -apply plugin: 'idea' - - allprojects { // group will translate to groupId during pom generation and deployment group = 'org.springframework.amqp' @@ -47,7 +58,7 @@ allprojects { // milestone or release. // @see org.springframework.build.Version under buildSrc/ for more info // @see gradle.properties for the declaration of this property. - version = createVersion(springAmqpVersion) + version = new Version(springAmqpVersion) // defoult set of maven repositories to be used when resolving dependencies repositories { @@ -95,16 +106,26 @@ coreprojects = javaprojects - sampleprojects // Configuration for all java subprojects // ----------------------------------------------------------------------------- configure(javaprojects) { - apply plugin: 'java' // tasks for conventional java lifecycle - apply plugin: 'maven' // `gradle install` to push jars to local .m2 cache - apply plugin: 'eclipse' // `gradle eclipse` to generate .classpath/.project - apply plugin: 'idea' // `gradle idea` to generate .ipr/.iml + apply plugin: 'java' // tasks for conventional java lifecycle + apply plugin: 'maven' // `gradle install` to push jars to local .m2 cache + apply plugin: 'eclipse' // `gradle eclipse` to generate .classpath/.project + apply plugin: 'idea' // `gradle idea` to generate .ipr/.iml + + // ensure JDK 1.6 compatibility + sourceCompatibility=1.6 + targetCompatibility=1.6 + + // set up dedicated directories for jars and source jars. + // this makes it easier when putting together the distribution + libsBinDir = new File(libsDir, 'bin') + libsSrcDir = new File(libsDir, 'src') - springVersion = '3.0.5.RELEASE' - rabbitVersion = '2.1.0' erlangVersion = '1.5.3' - slf4jVersion = '1.5.10' junitVersion = '4.8.2' + log4jVersion = '1.2.15' + rabbitVersion = '2.1.0' + slf4jVersion = '1.5.10' + springVersion = '3.0.5.RELEASE' // dependencies that are common across all java projects dependencies { @@ -125,18 +146,22 @@ configure(javaprojects) { // @see individual project(*) configurations below // ----------------------------------------------------------------------------- configure(coreprojects) { + // all core projects should be OSGi-compliant + apply plugin: 'bundlor' + // certain projects will need erlang licensing in addition to Apache. // false by default, but certain projects will assign true erlangLicense = false - // all core projects should be OSGi-compliant bundles - // add the bundlor task to ensure proper manifests - apply from: "$rootDir/gradle/bundlor.gradle" - apply from: "$rootDir/gradle/maven-deployment.gradle" + // add tasks for creating source jars and generating poms etc + apply from: "$buildSrcDir/maven-deployment.gradle" + + // add tasks for finding and publishing .xsd files + apply from: "$buildSrcDir/schema-publication.gradle" // dependencies common to all core projects dependencies { - compile ('log4j:log4j:1.2.15') { + compile ("log4j:log4j:$log4jVersion") { exclude group: 'javax.mail', name: 'mail' exclude group: 'javax.jms', name: 'jms' exclude group: 'com.sun.jdmk', name: 'jmxtools' @@ -147,6 +172,7 @@ configure(coreprojects) { runtime "org.slf4j:slf4j-log4j12:$slf4jVersion" } + // integration tests require a rabbitmq server up; ignore for now test.exclude '**/*IntegrationTests.class' } @@ -170,11 +196,16 @@ configure(sampleprojects) { compile "com.rabbitmq:amqp-client:$rabbitVersion" compile "org.springframework:spring-aop:$springVersion" compile "org.springframework:spring-oxm:$springVersion" - runtime 'log4j:log4j:1.2.14' - runtime 'cglib:cglib-nodep:2.2' runtime 'aspectj:aspectjrt:1.5.4' runtime 'aspectj:aspectjweaver:1.5.4' runtime "org.springframework:spring-context-support:$springVersion" + runtime('cglib:cglib-nodep:2.2') { optional = true } + runtime ("log4j:log4j:$log4jVersion") { + exclude group: 'javax.mail', name: 'mail' + exclude group: 'javax.jms', name: 'jms' + exclude group: 'com.sun.jdmk', name: 'jmxtools' + exclude group: 'com.sun.jmx', name: 'jmxri' + } testCompile "org.springframework:spring-test:$springVersion" } } @@ -186,6 +217,7 @@ configure(sampleprojects) { // @see configure(javaprojects) above for general config // ----------------------------------------------------------------------------- project('spring-amqp') { + description = 'Spring AMQP Core' dependencies { compile "org.springframework:spring-core:$springVersion" // TODO exclude commons-logging/commons-logging? @@ -195,8 +227,8 @@ project('spring-amqp') { } project('spring-erlang') { + description = 'Spring Erlang Support' erlangLicense = true - dependencies { compile "org.springframework:spring-beans:$springVersion" compile "org.erlang.otp:jinterface:$erlangVersion" @@ -204,6 +236,7 @@ project('spring-erlang') { } project('spring-rabbit') { + description = 'Spring RabbitMQ Support' dependencies { compile project(':spring-amqp') compile "com.rabbitmq:amqp-client:$rabbitVersion" @@ -220,8 +253,8 @@ project('spring-rabbit') { } project('spring-rabbit-admin') { + description = 'Spring RabbitMQ Administrative Support' erlangLicense = true - dependencies { compile project(':spring-amqp') compile project(':spring-erlang') @@ -241,19 +274,26 @@ project('spring-rabbit-admin') { // ----------------------------------------------------------------------------- -// Configuration for each individual sample subproject +// Configuration for sample projects // // @see configure(sampleprojects) above for general config // ----------------------------------------------------------------------------- +project(':spring-amqp-samples') { + description = 'Spring AMQP Samples' +} + project(':spring-amqp-samples:helloworld') { + description = 'Spring AMQP Hello World Sample' + generatePom { artifactId = 'helloworld' - artifactName = 'Spring AMQP Hello World' + artifactName = project.description artifactDescription = 'Shows the usage of Spring AMQP integration classes' } } project(':spring-amqp-samples:stocks') { + description = 'Spring AMQP Stocks Sample' dependencies { compile "org.springframework:spring-beans:$springVersion" compile "org.springframework:spring-core:$springVersion" @@ -266,7 +306,7 @@ project(':spring-amqp-samples:stocks') { generatePom { artifactId = 'stocks' - artifactName = 'Spring Rabbit Stocks' + artifactName = project.description artifactDescription = 'Shows the usage of Spring Rabbit integration classes' } @@ -290,22 +330,12 @@ project(':spring-amqp-samples:stocks') { } -// add basic tasks like 'clean' and 'assemble' to the root project. e.g.: allows -// running `gradle clean` from the root project and deleting the build directory -apply plugin: 'base' - -// add tasks like 'distArchive' -apply from: "$rootDir/gradle/dist.gradle" - -// add tasks like 'snapshotDependencyCheck' -apply from: "${rootDir}/gradle/checks.gradle" - - // ----------------------------------------------------------------------------- -// Import tasks related to releasing and managing the project -// depending on the role played by the current user. -// -// @see gradle.properties for more information on roles +// Configuration for the docs subproject // ----------------------------------------------------------------------------- -// add management tasks like `wrapper` for generating the gradlew* scripts -apply from: "$rootDir/gradle/wrapper.gradle" +project('docs') { + apply from: "$buildSrcDir/docs.gradle" +} + +apply from: "$buildSrcDir/dist.gradle" +apply from: "$buildSrcDir/checks.gradle" diff --git a/docs/build.gradle b/docs/build.gradle deleted file mode 100644 index 78dcd528..00000000 --- a/docs/build.gradle +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 2002-2010 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'base' -apply from: "$rootDir/gradle/docbook.gradle" - - -task build(dependsOn: assemble) { - group = 'Build' - description = 'Builds reference and API documentation and archives' -} - - -/** - * Build aggregated JavaDoc HTML for all core project classes. Result is - * suitable for packaging into a distribution zip or viewing directly with - * a browser. - * - * @author cbeams - * @author ltaylor - * @see http://gradle.org/0.9-preview-3/docs/javadoc/org/gradle/api/tasks/javadoc/Javadoc.html - */ - task api(type: Javadoc) { - group = 'Documentation' - description = "Builds aggregated JavaDoc HTML for all core project classes." - - // this task is a bit ugly to configure. it was a user contribution, and - // Hans tells me it's on the roadmap to redesign it. - srcDir = file("${projectDir}/src/api") - destinationDir = file("${buildDir}/api") - tmpDir = file("${buildDir}/api-work") - optionsFile = file("${tmpDir}/apidocs/javadoc.options") - options.stylesheetFile = file("${srcDir}/spring-javadoc.css") - options.links = ['http://static.springframework.org/spring/docs/3.0.3.RELEASE/javadoc-api'] - options.overview = "${srcDir}/overview.html" - options.docFilesSubDirs = true - title = "Spring AMQP ${version} API" - - // collect all the sources that will be included in the javadoc output - source coreprojects.collect {project -> - project.sourceSets.main.allJava - } - - // collect all main classpaths to be able to resolve @see refs, etc. - // this collection also determines the set of projects that this - // task dependsOn, thus the runtimeClasspath is used to ensure all - // projects are included, not just *dependencies* of all classes. - // this is awkward and took me a while to figure out. - classpath = files(coreprojects.collect {project -> - project.sourceSets.main.runtimeClasspath - }) - - // copy the images from the doc-files dir over to the target - doLast { task -> - copy { - from file("${task.srcDir}/doc-files") - into file("${task.destinationDir}/doc-files") - } - } -} - -/** - * Expand ${...} variables within docbook sources. This is a workaround - * accomodating the fact that the current docbook plugin has no way of - * parameterizing and replacing normal XML entities. - * - * Note that this task represents an implementation detail and it is - * unfortunate that it pollutes the listing of available tasks, e.g. - * during `gradle -t`. It's a good example of the need for 'task visibility' - - * a feature not yet implemented, but on the Gradle roadmap. - * - * @author cbeams - * @see http://jira.codehaus.org/browse/GRADLE-1026 - */ -task preprocessDocbookSources { - description = 'Expands ${...} variables within docbook sources.' - - doLast { - docbookSrcDir = file('src/reference/docbook') - docbookBuildDir = file('build/reference-work') - - // copy everything but index.xml - copy { - into(docbookBuildDir) - from(docbookSrcDir) { exclude '**/index.xml' } - } - // copy index.xml and expand ${...} variables along the way - // e.g.: ${version} needs to be replaced in the header - copy { - into(docbookBuildDir) - from(docbookSrcDir) { include '**/index.xml' } - expand(version: "$version") - } - } -} - -// ----------------------------------------------------------------------------- -// Configure the three docbook* tasks that are added to the project by the -// 'docbook' plugin. -// ----------------------------------------------------------------------------- -task reference(dependsOn: [docbookHtml, docbookHtmlSingle, docbookPdf]) { - group = 'Documentation' - description = 'Generates all HTML and PDF reference documentation.' -} - -[docbookHtml, docbookPdf, docbookHtmlSingle]*.sourceFileName = 'index.xml'; -[docbookHtml, docbookHtmlSingle, docbookPdf]*.dependsOn preprocessDocbookSources - -docbookHtml.stylesheet = file('src/reference/xsl/html-custom.xsl') -docbookHtmlSingle.stylesheet = file('src/reference/xsl/html-single-custom.xsl') -docbookPdf.stylesheet = file('src/reference/xsl/pdf-custom.xsl') -def imagesDir = file('src/reference/docbook/images'); -docbookPdf.admonGraphicsPath = "${imagesDir}/" - - -/** - * - * @see http://www.gradle.org/0.9-preview-3/docs/userguide/userguide_single.html#sec:copying_files - * @see http://www.gradle.org/0.9-preview-3/docs/javadoc/org/gradle/api/file/CopySpec.html - */ -docsSpec = copySpec { - into('') { - from('src/txt') - } - - into('api') { - from(api.destinationDir) - } - - into('reference') { - from("${buildDir}/reference") - } - - // copy images and css into respective html dirs - ['html', 'htmlsingle'].each { dir -> - into("reference/${dir}/images") { - from "src/docbook/images" - } - into("reference/${dir}/css") { - from "src/resources/css" - } - } -} - -task archive(type: Zip, dependsOn: [api, reference]) { - group = "Documentation" - description = "Create a zip archive of reference and API documentation." - - baseName = rootProject.name + '-docs' - - // drop it right in the root of the build dir for simplicity - destinationDir = buildDir - - // use the copy spec above to specify the contents of the zip - with docsSpec -} - -configurations { archives } -artifacts { archives archive } - -configurations { scpAntTask } -dependencies { - scpAntTask("org.apache.ant:ant-jsch:1.8.1") -} - -checkForProps(taskPath: project.path + ':uploadArchives', requiredProps: ['sshHost', 'sshUsername', 'remoteSiteDir']) - -uploadArchives { - def sshHost = project.properties.sshHost - def sshUsername = project.properties.sshUsername - def remoteSiteDir = project.properties.remoteSiteDir - def docUrl = "http://${sshHost}/${rootProject.name}/docs/${version.wildcardValue}/" - def remoteDocsDir = "${remoteSiteDir}/docs/${version.wildcardValue}" - def fqRemoteDir = "${sshUsername}@${sshHost}:${remoteDocsDir}" - - group = 'Buildmaster' - description = "Uploads and unpacks documentation archive" + (sshHost ? " to ${docUrl}" : ": Host is not specified") - - uploadDescriptor = false - - repositories { - add(new org.apache.ivy.plugins.resolver.SshResolver()) { - name = 'sshHost: ' + sshHost // used for debugging - host = sshHost - user = sshUsername - if (project.hasProperty('remoteSiteDir')) { - keyFile = sshPrivateKey as File - } - addArtifactPattern "${remoteDocsDir}/${archive.archiveName}" - } - } - - configurations { scpAntTask } - dependencies { scpAntTask 'org.apache.ant:ant-jsch:1.8.1' } - - doFirst { - println "Uploading: ${archive.archivePath} to ${fqRemoteDir}" - } - - doLast { - project.ant { - taskdef(name: 'sshexec', - classname: 'org.apache.tools.ant.taskdefs.optional.ssh.SSHExec', - classpath: configurations.scpAntTask.asPath) - - // copy the archive, unpack it, then delete it - def unpackCommand = "cd ${remoteDocsDir} && unzip ${archive.archiveName}" - def deleteCommand = "rm ${remoteDocsDir}/${archive.archiveName}" - - println "sshexec ${unpackCommand}" - sshexec(host: sshHost, username: sshUsername, keyfile: sshPrivateKey, command: unpackCommand) - println "sshexec ${deleteCommand}" - sshexec(host: sshHost, username: sshUsername, keyfile: sshPrivateKey, command: deleteCommand) - println "UPLOAD SUCCESSFUL - validate by visiting ${docUrl}" - } - } -} diff --git a/spring-amqp-samples/helloworld/pom.xml b/spring-amqp-samples/helloworld/pom.xml index 1baef5cc..38914da4 100644 --- a/spring-amqp-samples/helloworld/pom.xml +++ b/spring-amqp-samples/helloworld/pom.xml @@ -5,7 +5,7 @@ org.springframework.amqp.samples helloworld 1.0.0.BUILD-SNAPSHOT - Spring AMQP Hello World + Spring AMQP Hello World Sample Shows the usage of Spring AMQP integration classes @@ -65,7 +65,7 @@ log4j log4j - 1.2.14 + 1.2.15 runtime diff --git a/spring-amqp-samples/stocks/pom.xml b/spring-amqp-samples/stocks/pom.xml index 7f1346f6..e534fee8 100644 --- a/spring-amqp-samples/stocks/pom.xml +++ b/spring-amqp-samples/stocks/pom.xml @@ -5,7 +5,7 @@ org.springframework.amqp.samples stocks 1.0.0.BUILD-SNAPSHOT - Spring Rabbit Stocks + Spring AMQP Stocks Sample Shows the usage of Spring Rabbit integration classes @@ -83,7 +83,7 @@ log4j log4j - 1.2.14 + 1.2.15 runtime