Hello,
I need to copy dependencies of gradle plugins (quality plugins like pmd, jacoco, etc.) and utils to different directories to use them on an offline station with flat directories declaration. I want them in separate directories to import them on demand and not in a fat directory.
1/ Why the script below doesn’t work? Actually, it creates only “testng” directory (last in alphabetical order) and copy all dependencies in. And I see all the configurations go through the “println” so I know it iterate over the configurations.
I’m sure it’s just a typo in Groovy but I can’t figure it out.
2/ Is there a better way to get the dependencies of a plugin than activate it on the offline machine, check what Graddle try to download and add it to the script on the online machine?
3/ The jacoco plugin doesn’t work, I need to download the jacoco-0.7.6.201602180812.zip and expand it in a directory cause the download on jcenter miss doc and examples. Any idea?
Not too worry, the CopySpec notation catches me out every now an dthen and I use it quite a bit!
Normally one supplies a top-level into for the Copy task. This tell it the root folder to copy to. Then you can use the into( Object, Closure) notation (see Copy task for info) to add child copy specs which will write into subfolders. You should also read up on Copy.with. Usually in Groovy with is just a delegate closure to object it is atatched to, but in Copy it behaves differently. There it allows you to attach a CopySpec as a child of the parent that is the Copy task. It can also be used to copy into subfolders.
That information is remarkably hard to find. You may catch the clues here:
If you want to use plugins offline, don’t use the plugins {} syntax. Rather use the old buildscript {} syntax. Here are examples of how to it was accomplished:
BTW If a plugin pulls down additional dependencies during task execution, then we are on a different playing field. Some of them can be handled (i.e. jruby-gradle-base & the latest ascidoctor, but some plugins assume that you will be online). If you have any of those you can raise them on Github and I’ll have a look.