Closed ethauvin closed 7 years ago
collect(compileDependencies)
returns List<File>
, which works in most case.
Assuming:
dependencies {
compile("org.apache.velocity:velocity:1.7")
compile("example.com:foo:bar:1.0")
}
How can I have velocity
copied to my install target
directory, but not foo.bar
?
install {
target = deploy
collect(compileDependencies).forEach {
if (it.absolutePath.contains("velocity")) {
copy(from(it.absolutePath), to("$target/lib"))
}
}
}
Pretty weak, IMHO.
Is it viable to make collect()
return both files
and Maven coordinates
?
Sure but how would that help? You'd still need an if here.
-- Cédric
On Thu, Apr 6, 2017 at 8:00 PM, Erik C. Thauvin notifications@github.com wrote:
collect(compileDependencies) returns List
, which works in most case. Assuming:
dependencies { compile("org.apache.velocity:velocity:1.7") compile("example.com:foo:bar:1.0") }
How can I have velocity copied to my install target directory, but not foo.bar?
install { target = deploy collect(compileDependencies).forEach { if (it.absolutePath.contains("velocity")) { copy(from(it.absolutePath), to("$target/lib")) } } }
Pretty weak, IMHO.
Is it viable to make collect() return both files and Maven coordinates?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cbeust/kobalt/issues/392#issuecomment-292413326, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFoohIRWy3Qtna2-ym5aMq-sJQnMF-oks5rtabkgaJpZM4M2Y6M .
True, but it is a very weak if
, because I have no clues as to what the filename is.
Take a scenario when multiple packages use a different version of 'commons-lang`, but I would only want the most recent version to be in my deployment directory; unless I hard-code the filename, there's no way to do it. On the other hand, if I can compare against my previously specified coordinates, I'm good.
As discussed, compileAptDependencies
should be implemented for use in collect()
So should I add a collectIds()
directive or have collect()
return both the file name and id?
I'm not wild about collectIds()
.
collect()
could return both, or you could use a flag parameter, collect(dependencies: List<IClasspathDependency>, mavenIds: Boolean = false)
or something like that.
I take that back, collect()
returning both, is best. It'll allow for one call to collect()
to check for multiple options, e.g.:
collect(compileDependencies).forEach {
if (it.file.abolutePath.equals("blah")) {
...
} else if (it.id.equals("foo") {
...
}
}
Any comments on https://github.com/cbeust/kobalt/issues/392#issue-220091021?
That's a big one for me, and I think that's a caching issue.
Let me expand on https://github.com/cbeust/kobalt/issues/392#issue-220091021
I'm using an annotator, which requires both apt(annotatorJar)
and compile(annotatorJar)
, like most do.
The problem is when I'm using collect(compileDependencies)
, I'm getting the annotator jar and it's dependencies, but I don't really need them to be deployed to the install
target.
Gradle addresses that issue by providing a compileOnly 'annotatorJar'
directive. Meaning that when collecting the compile dependencies, no annotator dependencies will be included.
Fixed in 1.0.55.
Assuming:
which resolves to:
collect(compileDependencies)
will returnvelocity
,commons-collections
andcommons-lang
as expected.Change to:
collect(compileDependencies)
will still return all three dependencies, not justvelocity
.