description = 'Spring Integration Kafka Sample'

buildscript {
	repositories {
		mavenCentral()
		//mavenLocal()
		maven { url 'https://repo.spring.io/simple/ext-release-local' }
	}
	dependencies {
			classpath 'org.apache.maven:maven-artifact:2.2.1' // 3.x won't work
			classpath 'org.apache.avro:avro-compiler:1.7.3' // use Avro 1.7.4 to compile the Avro files
			//classpath 'org.clojars.miguno:avro-gradle-plugin:1.7.2'
			classpath "org.apache.avro:avro-gradle-plugin:1.7.2"
	}
}

apply plugin: 'base'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'avro-gradle-plugin'

ext {
	avroTaskGroup = "Avro"
	avroSource = "schemas"
	avroDest = "target/generated-avro-sources/main/java"
}

repositories {
	maven {
		url 'https://repository.apache.org/content/groups/public'
	}
	maven { url 'https://repo.springsource.org/libs-milestone' }
	mavenLocal()
}

dependencies {
	compile "org.springframework.integration:spring-integration-stream:$springIntegrationVersion"
	compile("org.springframework.integration:spring-integration-kafka:$springIntegrationKafkaVersion") {
		exclude module: 'log4j'
		exclude module: 'jms'
		exclude module: 'jmxtools'
		exclude module: 'jmxri'
	}
	compile("log4j:log4j:1.2.15") {
		exclude module: 'mail'
		exclude module: 'jms'
		exclude module: 'jmx'
		exclude module: 'jmxtools'
		exclude module: 'jmxri'
	}
	compile "commons-logging:commons-logging:1.1.1"
}

compileAvro.group = avroTaskGroup
compileAvro.description = "Generates Java code from avro schema"
compileAvro.source = avroSource
compileAvro.destinationDir = file(avroDest)

task cleanAvro(type: Delete) {
	group = avroTaskGroup
	description = "deletes generated avro code"
	delete avroDest
}

compileJava.dependsOn compileAvro

sourceSets {
	main {
		java {
			srcDir avroDest
		}
		resources {
			srcDir avroSource
		}
	}
}

task wrapper(type: Wrapper) {
	description = 'Generates gradlew[.bat] scripts'
	gradleVersion = '1.8'
}

eclipse {
	project {
		name = "spring-integration-kafka-sample"
	}
}

defaultTasks 'clean', 'build'
