Могу ли я добавить пользовательские объекты в контекст Velocity с помощью плагина архетипа Maven?

У нас есть несколько генераторов кода, которые используютСкорость генерировать проекты. Поколение может быть довольно сложным:

reflection is used (to introspect 3rd party proxies that we have to interface with) prior to calling velocity - the resulting properties (a complex object graph) are added to the velocity context

the project structure and files can vary depending on the options selected

the templates do more than just variable substitution (they make use of a custom object added to the velocity context, which contains many derived properties, including collections of other objects which are iterated over in the templates)

Я хотел бы заменить ихархетипы мавена поскольку они также используют Velocity, но, похоже, они только способны к простой подстановке переменных и статической структуре файлов / папок.

Is there a way to do processing prior to creating a project from an archetype, add objects to the velocity context, and have the archetype templates be able to access them?

If so, can the folders and files to create be dynamic? (or do you need a separate archetype for each variation?)

Or is it better to write a custom Mojo? (essentially wrapping the existing generator with a Maven plugin)

Ответы на вопрос(0)

Ваш ответ на вопрос