Comment créer un fichier de construction Ant à partir de Maven (pom.xml)?

Comment créer un fichier de construction Ant à partir de Maven (pom.xml)?

Dans certains cas, vous devrez peut-être générer le fichier de construction Ant (build.xml) pour l'intégration de votre projet. Par exemple, le fichier Antklockwork code analysis tool est requis pour effectuer les processus d'analyse de code statique pour le projet java.

Plugin Maven Ant

Maven est livré avec un plugin Ant pratique pour générer facilement le fichier de construction Ant à partir de Maven pom.xml. Localisez votre fichier pom.xml et exécutez la commande:mvn ant:ant.

D:\Project_ABC>mvn ant:ant

Sortie

D:\Project_ABC\SWP>mvn ant:ant
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'ant'.
[INFO] artifact org.apache.maven.plugins:maven-ant-plugin: checking for updates from central
...
[INFO] ------------------------------------------------------------------------
[INFO] Building abc
[INFO]    task-segment: [ant:ant]
[INFO] ------------------------------------------------------------------------
...
Downloading: http://repo1.maven.org/maven2/xalan/xalan/2.7.0/xalan-2.7.0.pom
491b downloaded
...
Downloading: http://repo1.maven.org/maven2/xalan/xalan/2.7.0/xalan-2.7.0.jar
2666K downloaded
[INFO] [ant:ant]
[INFO] Wrote Ant project for ABC to D:\Project_ABC
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28 seconds
[INFO] Finished at: Thu Feb 12 16:16:15 SGT 2009
[INFO] Final Memory: 9M/16M
[INFO] ------------------------------------------------------------------------

Done

Maven vient de créer 3 fichiers Ant - build.xml, maven-build.xml et maven-build.properties.

Note
Pour plus de détails, veuillez visiter ceMaven’s Ant plugin official page