Horcrux7
(Horcrux7)
February 14, 2014, 9:37am
1
What is the best syntax to remove a jar file from the testCompile dependency. I have found the follow solution:
dependencies {
compile ':AbcObfuscated'
testCompile ':AbcVanilla'
}
compileTestJava {
classpath = classpath.filter{ File file ->
!file.name.equals( "Abc.jar" )
}
}
But is is not nice. I look for some think like the follow:
dependencies {
compile ':AbcObfuscated'
testCompile.exclude ':AbcObfuscated'
testCompile ':AbcVanilla'
}
Or we can change the order of the jar files that testCompile come before compile.
Maven and Ivy dependencies can be excluded with ‘configuration.exclude’. For project/file dependencies, I’m not aware of a better solution than ‘configuration.filter’. And I wouldn’t rely on ordering.
Horcrux7
(Horcrux7)
February 15, 2014, 2:24pm
3
This means my solution is already the best solution?
I would think so. The filter statement can be shortened to ‘classpath = classpath.filter { it.name == “Abc.jar” }’.
Horcrux7
(Horcrux7)
February 17, 2014, 7:33am
5
Thanks, I have use now: classpath = classpath.filter { it.name != “Abc.jar” }.
Seems that this doesn’t work any more. I am left with the following error message.
Build file ‘/home/yves/arbeit/fidesmo/ykneo-oath/build.gradle’ line: 22
A problem occurred evaluating root project ‘ykneo-oath’.
Could not find property ‘exclude’ on
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@1a3836f1.
How can I affect the odering of the jars? Are they sorted in the order they are added?
Horcrux7
(Horcrux7)
October 17, 2014, 3:06pm
7
Yes, the order is equals to the adding order.