I have to use a dependency sapjco3 in my project. The resolved jar contains the version number as usual, in my case it’s sapjco3-3.0.13.jar.
As such, this jar is also contained in Class-Path attribute of the manifest.
The problem is, that the name of the jar must be sapjco3.jar, which is checked at runtime: using the jar named sapjco3-3.0.13.jar leads to an exception at runtime.
My question:
how am I supposed to omit the version in the artifact’s filename - and finally have it included in the manifest class-path correctly, i.e. without the version number?
Hi Lance,
thanks for your reply - unfortunately it didn’t solve my problem: compile files({tasks.renameSapjco3}) does not seem to be sufficient to provide the sapjco3.jar to compile (btw: I use implementation): the classes contained in the jar cannot be found, so compilation errors occur.
What is more, I do not fully understand your suggestion:
you define a configuration sapjco3
then add the dependency
then ‘pipe’ it’s deps through the copy-task to perform the renaming
to finally add the task’s “results” as deps for implementation
So the trick is this files of a task dep?
I don’t understand what the copy into a dir renameSapjco3 is good for
And as I said: it does not seem to work, yet Am I missing something? Any other suggestions?
Hi Lance,
with your hints I’ve been able to figure it out:
listing the jars revealed that not the renamed jar sapjco3.jar has been added to the deps by files({tasks.renameSapjco3}), but only the folder name /$buildDir/renameSapjco3
It’s a timing thing, I was worried that files({tasks.renameSapjco3}).asFileTree might force the resolution too early… or perhaps the task dependency might be lost (ultimately meaning that compileJava task would not depend on renameSapjco3)