Skip to content

Instantly share code, notes, and snippets.

@lifuzu
lifuzu / build.gradle
Created December 15, 2013 04:21
Copying a file with keyword expansion
//Copying a file with keyword expansion
versionId = '1.6'
task copyProductionConfig(type: Copy) {
from 'source'
include 'config.properties'
into 'build/war/WEB-INF/config'
expand([
databaseHostname: 'db.company.com',
version: versionId,
@lifuzu
lifuzu / build.gradle
Created December 15, 2013 04:35
Trying to set the destinationDir property of a Jar task
//Trying to set the destinationDir property of a Jar task with a string
jar {
destinationDir = 'build/jar'
}
//Trying to set the destinationDir property of a Jar task with a string
jar {
destinationDir = new File('build/jar')
}
//Setting the destinationDir property of a Jar task using the file() method
jar {
@lifuzu
lifuzu / build.gradle
Created December 15, 2013 04:44
Printing out all of the compile-time dependencies of the build as a path-like string
//Printing out all of the compile-time dependencies of the build as a path-like string
println configurations.compile.asPath
@lifuzu
lifuzu / build.gradle
Created December 15, 2013 04:50
Creating an intersection of two FileCollections
//Creating an intersection of two FileCollections
def poems = fileTree(dir: 'src/main/resources', include: '*.txt')
def romantics = fileTree(dir: 'src/main/resources', include: 'shelley*')
def goodPoems = poems - romantics
@lifuzu
lifuzu / build.gradle
Created December 15, 2013 04:51
Using FileCollection addition to create a runtime classpath
//Using FileCollection addition to create a runtime classpath
task run(type: JavaExec) {
main = 'org.gradle.example.PoetryEmitter'
classpath = configurations.compile + sourceSets.main.output
}
import org.gradle.api.NamedDomainObjectContainer
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import liquibase.integration.commandline.Main
apply plugin: LiquibasePlugin
buildscript {
@lifuzu
lifuzu / liquibase.properties
Last active December 31, 2015 10:48
The contents of the liquibase.properties meta file, in the src/resources/META-INF/gradle-plugins directory of the project.
#The contents of the liquibase.properties meta file
implementation-class=com.augusttechgroup.gradle.liquibase.LiquibasePlugin
@lifuzu
lifuzu / build.gradle
Created December 15, 2013 16:50
A simplified plug-in build file
//A simplified plug-in build file
apply plugin: 'groovy'
repositories {
mavenCentral()
}
dependencies {
groovy 'org.codehaus.groovy:groovy:1.8.6'
compile gradleApi()
artifacts {
archives file: 'A.jar', name: 'A', type: 'jar'
archives file: 'B.jar', name: 'B', type: 'jar'
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: "dav:https://myRepo.com/release/") {
@lifuzu
lifuzu / build.gradle
Created December 17, 2013 01:52
Upload an existing collection of 3rd-party Jars to a Maven server in Gradle?
apply plugin:'java'
apply plugin:'maven'
import org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact
version = "6.1.1"
group = "com.oahu"
ant.importBuild "$projectDir/tools/ant/package.xml"