Horcrux7
(Horcrux7)
1
I use the follow block to copy a single line:
copy {
from jar.archivePath
into pluginfiles
rename { String fileName ->
fileName = 'server.jar'
}
}
This is very extensive. I would like a syntax like:
copy ( from: jar.archivePath, to: "${pluginfiles}/'server.jar" )
Is it possible to add this in future versions?
You can easily write a convenience method to achieve this. Note that it’s often better to use a ‘Copy’ task than a ‘copy’ method.
Horcrux7
(Horcrux7)
3
If I define such method first then the overhead more expensive. This make no sense.
A task has the disadvantages that it need to define in the configuration phase. The advantages are minimal.
If I define such method first then the overhead more expensive.
I can’t tell which overhead you are referring to.
A task has the disadvantages that it need to define in the configuration phase. The advantages are minimal.
There are a lot more advantages than that. Anyway, the task and method have the same API, so any change would apply to both of them.
By the way, your snippet won’t rename the file. Here is a correct version:
copy { from jar.archivePath; into pluginfiles; rename { 'server.jar' } }
That’s not significantly longer than your proposal.