You can write Maven plugins based on Ant scripts.
... <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.2</version> <dependencies> <dependency> <groupId>org.apache.maven.plugin-tools</groupId> <artifactId>maven-plugin-tools-ant</artifactId> <version>3.2</version> </dependency> </dependencies> </plugin> </plugins> </build> ...
The Ant plugin consists in two files. If you want to create a touch plugin, you must have:
<pluginMetadata xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/plugin-metadata-1.0.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>