How to add custome steps for building webapps

I have a ant build script for building my webapp , there i have some targets that merges resource bundles , copying some spring application context files to a specific directory and so on , i want to convert it to gradle build script. my question is that is it correct that i use war plugin and add tasks to its build life cycle for each build steps , or i have to create a new plugin from scratch for my target? witch one is the correct way? thnx in advance

I think in general, if the war plugin provides functionality you can use, then apply it and add any functionality that’s still needed. That functionality might take the form of your own plugin that potentially builds on top of the war plugin. On the other hand, if the functionality you need is greatly different than what the war plugin provides, it might just get in the way more than it helps.

You should probably start with the ‘war’ plugin. If need be, you could add some extra tasks to do the extra work you need. You could always add the outputs from another task to the inputs of your ‘war’ configuration.

// assuming you have task 'abc'
  war {
  from {abc.outputs.files}
}

thnx gary for you answer