Add some jar to classpath in a JavaExec task

I need an other jar file in my SomeTask extends JavaExec { … (defined in a .groovy)
There is already a classpath(project.project(’…’).libsDir.path+’/…jar’) in constructor.
The jar I want to add is specified in some .gradle files for compilation as
implementation ‘somepackage:somename:someversion’ (located in a kind of maven repo?)
How can I get this jar in classspath(???) ?.

Related, How to use in gradle javaexec with classpath dependency
but I don’t see how to do (configurations + dependencies) it in my (sub-project shared) Groovy class.