Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I chain different archetypes together?

Is it possible to somehow chain archetypes together by some super-archetype in Maven?

For example I have an archetype create a multi-module project setup. One of these module projects should be created by another archetype. This archetype is not controlled/developed by myself and availible versions change independently of my multi-module archetype.

Therefore is it possible to define some kind of a super-archetype which executes my archetype A creating the full multi-module setup and afterward creating a module by executing another archetype?

If that is not possible - maybe there is another way to achieve this by using some other Maven functionality?

like image 895
Sebastian J. Avatar asked Nov 13 '22 13:11

Sebastian J.


1 Answers

If I understand correctly you could use your archetype to create your multimodule setup but lack the possibiliy to create one of the modules through another archetype. I don't know of a super-archetype but perhaps this approach is helpful:

You could either extend the pom of your archetype or use the goals commandline argument of the generate-goal to fire a second archetype generation (f.e. via the antrun plugin) and embed the result in your multimodule setup. To automate generation for the third-party archetype you can use the individual parameters of the generate goal (again).

like image 106
Jan Avatar answered Dec 28 '22 16:12

Jan