You can write Maven plugins based on Ant scripts.
<project> ... <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-script-ant</artifactId> <version>2.2.1</version> </dependency> </dependencies> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId> <version>3.5</version> <dependencies> <dependency> <groupId>org.apache.maven.plugin-tools</groupId> <artifactId>maven-plugin-tools-ant</artifactId> <version>3.5</version> </dependency> </dependencies> </plugin> </plugins> </build> ... </project>
The Ant plugin consists in two files. If you want to create a touch plugin, you must have:
<pluginMetadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/PLUGIN-METADATA/1.1.0" xsi:schemaLocation="http://maven.apache.org/PLUGIN-METADATA/1.1.0 http://maven.apache.org/xsd/plugin-metadata-1.1.0.xsd"> <mojos> <mojo> <!-- target name to call in ant script --> <call>touch-file</call> <!-- mojo goal name --> <goal>touch</goal> <parameters> <parameter> <name>name</name> <expression>${name}</expression> <required>true</required> <readonly>false</readonly> <type>java.lang.String</type> </parameter> </parameters> </mojo> </mojos> </pluginMetadata>