How to move a dependency with specific suffix to a folder in war plugin

Hi,

axis2 requires .mar files (modules) to be stored in a /modules folder within the resulting war file. The mar file is currently available as a dependency, and thus resides in WEB-INF/lib . I would like to have it moved to /modules.

axis2 jaxws-samples uses maven and does it like this:

<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-modules</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/modules</outputDirectory>
                <includeTypes>mar</includeTypes>
            </configuration>
        </execution>
    </executions>
</plugin>

What would the alternative be in Gradle? I’m pretty new at Gradle, using Kotlin DSL, and having difficulties finding the correct way to do this. Any help is very much appreciated.

Looking into this more myself and including possible solution for whoever may be interested.

In distributions plugin one can configure Distribution object with contents which is CopySpec typed. CopySpec allows to configure copy and rename rules for the distribution. Will try to implement this later.

edit: noticed CopySpec rename possibilities in jar task as well, so I guess that would be the place to check for jar generation.