You just can't, because Maven has a life cycle build
You must understand that Maven has a life cycle to build , and this is your plan. You must forget Ant targets.
The life cycle has, for example, test compilation (compilation of unit tests) and compilation (compilation of your production code). Further steps are performed by unit tests and finally pack your production code into a jar file.
Using maven-antrun-plugin is not recommended (only in very very very rare cases).
Via mvn release: prepare release: run or via mvn deploy (for SNAPSHOT)
I recommend reading Maven Books, in particular Maven, as an example and Maven: The Complete Reference
If you work in a company, you should consider setting up a storage manager (for example, Nexus or Archiva, etc.).
source share