I'm looking for a way, to execute additional commands (e.g. a perl script) after running mvn archetype:generate on my custom archetype automatically.
Is this possible?
I'm writing an archetype, that creates OSGi bundles which i want to integrate into a parent project as modules. After generating the bundle, i wish to organise it into the parents directory structure and then manipulate poms and other configuration files automatically.
This has been asked on maven forums before 1, however no answer was given.
maven. archetype</groupId> <artifactId>archetype-packaging</artifactId>
Goals Overview The archetype plugin has four goals for direct use: archetype:generate creates a Maven project from an archetype: asks the user to choose an archetype from the archetype catalog, and retrieves it from the remote repository. Once retrieved, it is processed to create a working Maven project.
To create a new project based on an Archetype, you need to call mvn archetype:generate goal, like the following: mvn archetype:generate.
Generates a new project from an archetype, or updates the actual project if using a partial archetype. If the project is fully generated, it is generated in a directory corresponding to its artifactId.
Thrau, you can invoke mojo post execution of archetype:generate by adding -Dgoals="your custom mojo plugin", within the plugin you can write your custom code. Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With