import org.apache.tools.ant.filters.ReplaceTokens apply plugin: "groovy" apply plugin: "maven" apply plugin: "war" // webAppDirName = "build/webapp/main" buildscript { dependencies { classpath 'com.jdbernard:gradle-exec-util:0.2.0' } } dependencies { compile localGroovy() compile 'ch.qos.logback:logback-classic:1.1.8' compile 'ch.qos.logback:logback-core:1.1.8' compile 'org.slf4j:slf4j-api:1.7.22' compile 'com.impossibl.pgjdbc-ng:pgjdbc-ng:0.6' compile 'com.lambdaworks:scrypt:1.4.0' compile 'com.zaxxer:HikariCP:2.5.1' compile 'javax:javaee-api:7.0' compile 'javax.ws.rs:javax.ws.rs-api:2.0.1' compile 'joda-time:joda-time:2.7' runtime 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.3.2' runtime 'org.glassfish.jersey.containers:jersey-container-servlet:2.16' runtime 'org.glassfish.jersey.media:jersey-media-json-jackson:2.16' providedCompile 'javax.servlet:javax.servlet-api:3.1.0' testCompile 'junit:junit:4.12' testCompile 'com.jdblabs:db-migrate.groovy:0.2.5' testRuntime 'com.h2database:h2:1.4.186' } war { from "resources/webapp" from "build/webapp" filter(ReplaceTokens, tokens: [version: version]) rename '(.+)(\\..*(css|js))', '$1-' + version + '$2' webInf { from 'resources/main/WEB-INF' } exclude "**/.*.swp", "**/.sass-cache" } test { testLogging { events 'failed' } } task testWar(type: War) { from 'resources/webapp' filter(ReplaceTokens, tokens: [version: version]) rename '(.+)(\\..*(css|js))', '$1-' + version + '$2' webInf { from 'resources/test/WEB-INF' } classifier 'test' } task compileScss( group: 'build', description: 'Compile SCSS files into CSS.', type: Exec ) { executable "scss" args "--update", "src/main/webapp/css:build/webapp/css" } war.dependsOn compileScss testWar.dependsOn compileScss task deployProd(dependsOn: ['build']) { doLast { def warName = "${project.name}-${version}.war" def artifactName = "ROOT.war" copy { from "build/libs" into "build" include warName rename warName, artifactName } exec("eb", "deploy", "-l", "${parent.name}-${project.name}-${version}") } }