Skip to content

Instantly share code, notes, and snippets.

@grimrose
Created May 7, 2013 17:10
Show Gist options
  • Save grimrose/5534316 to your computer and use it in GitHub Desktop.
Save grimrose/5534316 to your computer and use it in GitHub Desktop.
Copyタスクを使ってdependenciesを振り分ける場合
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile 'org.slf4j:slf4j-api:1.7.5'
testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-all:1.3'
runtime 'org.slf4j:slf4j-simple:1.7.5'
}
def jars = configurations.testCompile - configurations.compile
defaultTasks 'cleanExtra', 'copyTestCompileJars'
task copyTestCompileJars << {
println "copy test compile jars."
}
task cleanExtra << {
delete "${projectDir}/extra"
}
task copyHamcrestJars(type: Copy) {
from (jars) {
include "hamcrest-*"
}
into "${projectDir}/extra/hamcrest"
}
task copyJUnitJar(type: Copy) {
from (jars) {
include "junit-*"
}
into "${projectDir}/extra/junit"
}
task copyAnotherJars(type: Copy) {
from (configurations.testCompile) {
exclude "hamcrest-*"
exclude "junit-*"
}
into "${projectDir}/extra"
}
copyTestCompileJars.dependsOn copyHamcrestJars, copyJUnitJar, copyAnotherJars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment