Created
May 7, 2013 17:10
-
-
Save grimrose/5534316 to your computer and use it in GitHub Desktop.
Copyタスクを使ってdependenciesを振り分ける場合
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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