I created a method to achieve this:
def archiveFilesWithoutPath(globPattern) { def files = findFiles(glob: globPattern) for (def i = 0; i < files.size(); i++) { def file = files[i] def parentFolder = new File(file.path).getParent() dir(parentFolder) { archiveArtifacts file.name } } }
Is used as follows:
archiveFilesWithoutPath '**/build/libs/*.jar'
The only downside at the moment is that you need to allow
new java.io.File java.lang.String
and
method java.io.File getParent
In the approval of the script.
Roemer
source share