自定义 Maven 原型或项目生成的替代方案
我们希望从 Maven Archetype 生成项目,但我们发现它有点简单化。我们希望做到以下几点:
- 有一个简单的起点。不要问太多问题。
- 允许稍后(或在原始生成期间)使用附加功能更新项目。
- 允许添加/删除/更新项目功能。
- 更新 pom.xml、spring xml 文件,可能还有其他 XML 文件和属性文件。
- 从合同生成存根 Web 服务,包括单元测试。
- 生成 Eclipse / Intellij 项目会很好。
- 一些相当复杂的生成,例如将名称空间/类填充到 spring 拦截器中会很好。特别是如果它可以产生所述值。
Maven Archetypes 似乎除了在初始生成期间进行选择以及稍后添加文件之外不支持任何其他功能。我没有看到任何对修改现有文件的支持?我们可以通过正常的 Maven 构建生成存根 Web 服务,但似乎无法在 archetype:generate 期间运行任意 Maven 插件?
如果有人知道上述任何问题的答案,我们很乐意听到。此外,如果有人对我们正在寻找的功能集有替代方案,我们也想了解它们。
We would like to generate projects from a Maven Archetype but we are finding it a bit simplistic. We would like to do the following:
- Have a simple starting point. Not ask too many questions.
- Allow updating the project later (or during the original generate) with additional features.
- Allow adding / deleting / updating the project features.
- Updating pom.xml, spring xml files, possibly other XML files and property files.
- generation of stubbed web services from contracts, including unit tests.
- generation of Eclipse / Intellij projects would be nice.
- Some reasonably complex generation of things like populating namespaces / classes into spring Interceptors would be nice. Especially if it could generate said values.
Maven Archetypes do not appear to support anything more than making choices during the initial generation, and adding files later. I don't see any support for modifying existing files? We can generate stubbed web services via a normal maven build, but do not appear to be able to run arbitrary maven plugins during the archetype:generate?
If anyone knows the answers to any of the above, we like to hear it. Also if anyone has alternatives for the feature set that we are looking for we would like to know about them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们为我们的项目做了类似的事情。
我们定义了一个专用插件,它本身将调用 Archetype:generate 插件。
这样我们就可以依赖Archetype:generate的能力(自动解析和替换部分生成的类...)。
您可以在我们的 SVN 上查看此项目: http://websvn.ow2.org/listing.php?repname=weblab&path=%2Ftrunk%2FWebLabTools%2FMavenPlugins%2F&#。
注意:该代码是由实习生完成的,请友善;-)
We did something like that for our project.
We defined a dedicated plugin that will itself call the Archetype:generate plugin.
This way we can rely on a the Archetype:generate capabilities (automatic parsing and replacement of part of the generated classes...).
You can have a look at this project on our SVN here: http://websvn.ow2.org/listing.php?repname=weblab&path=%2Ftrunk%2FWebLabTools%2FMavenPlugins%2F&#.
Note: That the code has been done by a trainee, please be kind ;-)