Renaming Folder in War task


(Sebastian Schroeder) #1

Hey there,

I want to rename a folder in the war task. I tried using this syntax:

war {

rename ‘test.abc’, ‘test.xyz’ }

It works fine for files but it does not work when using it on folders. What am I doing wrong? I haven’t found anything in the documentation or on the web that suggested a fix.

Thanks for the help.

Cheers, Sebastian


(Tom Sheehan) #2

Sebastian,

Consider:

// given the existence of folder named 'wall', it is renamed to 'door'
 ant.move(file: 'wall', toFile: 'door')

Tom


(Rolf Suurd) #3

While not a sweet one-liner like Tom posted, you could try adding another “from” clause with a different “into”. This will require you to exclude the “renamed” folder, or else it too will wind up in the war, like this:

war {
    from ('test.abc') {
        into 'test.xyz'
    }
      exclude('**/test.abc/**')
}