Thanks for the hint. But your solution is to static. We have approx 50 files to add in this way. This will be confused. This is the same more dynamic. It fetch ever the latest version.
This are 50 different “from” expressions because different “into”, “filter” settings. This are not only jar files, also zip files, images, scripts, etc. It is the final build script that accumulate the results from many other build job to a distribution.
@Horcrux, I think @Lance_Java has already given you the clue to this. Remember that the from statement can take many kinds of input. If you are going to copy from another subproject within your project then doing from project(':foo') shoudld o it to get the artifacts from that project.
However if I assume what you mean by repository is what we would understand as a repository in Gradle, you can also do things like
from configurations.CONFIG_NAME.files, {
include '**/foo.jar'
}
which would hopefully avoid the need for 50 from declarations.
Just to be clear: in Gradle terms repositories are external stores (including local filesystems) where you can obtain artifacts from, using (mostly) maven coordinates. Configurations are where you actually tell Gradle what you need.
@Schalk_Cronje, With my function resourceFile I have solve my problem. The problem with your solution is:
I need to declare the file names 2 times.
The name is changed. For example to foo_2.2.jar. I need to add a rename. This means I must declare the file name 3 times. The file names with version broke many links. This would require to change hundreds of files every day if a version change.