buildr 中的父构建文件
我目前正在考虑从 maven2 迁移到 buildr,我担心如何保持构建脚本干燥。
目前我们的maven项目是用包含所有常见构建代码的父pom文件定义的,并且像任何其他依赖项一样被拾取:
<parent>
<groupId>com.companyname</groupid>
<artifactId>parent</artifactId>
<version>1.0.0</artifactId>
</parent>
现在我正在查看buildr,我注意到它确实有一个类似的概念,但它需要将构建文件放置一层 -例如:
/svnrepo/buildfile
/svnrepo/ProjectA
/svnrepo/ProjectB
这是一个问题,因为这些项目不相关,并且将完全单独检查和构建。所以我的问题是:如何最好地解决这个问题?如何引用通用构建文件,同时一次只能签出一个项目?
I am currently looking at migrating from maven2 to buildr and I am concerned about how get to keep the build scripts DRY.
Currently our maven project is defined with parent pom file containing all common build code and is picked up like any other dependency:
<parent>
<groupId>com.companyname</groupid>
<artifactId>parent</artifactId>
<version>1.0.0</artifactId>
</parent>
Now I am looking at buildr and I notice that it does have a simular concept but it would require placing a buildfile one level-up, for example:
/svnrepo/buildfile
/svnrepo/ProjectA
/svnrepo/ProjectB
This is a problem however because these projects are not related and will be checked out and build totally separately. So my question is: how do I best solve this problem? How do I reference a common buildfile while being able to checkout only one project at a time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了这个问题的答案,我很自责它是多么容易:创建一个 gem。
将parent-pom.xml 替换为parent.rb 并将ruby 文件作为所有其他项目所需的gem 进行分发。
I discovered the answer to this problem and I am kicking myself about how easy it is: create a gem.
replace parent-pom.xml with parent.rb and distribute the ruby file as a gem to be required by all other projects.
我认为你很困惑:
一方面,你的项目现在是与 Maven 一起构建的,有 4 个不同的存储库,你可以在正确的位置检查或使用 svn:externals。这听起来是个坏主意。
另一方面,您想使用 Builder 做同样的事情,但担心它看起来不太好?
请确实单独构建这些项目!如果您的代码可以从一个项目重用到另一个项目(例如自定义任务),则可以在每个项目中使用 svn:externals 指向构建文件所需的 ruby 文件。
I think you are confused:
on one hand, your projects are right now built together with Maven, with 4 different repositories that you check out in the right places or use svn:externals. That sounds like a bad idea.
On the other hand, you want to do the same thing with Buildr, but are concerned it's not going to look good ?
Please build those projects separately indeed! If you have code that can be reused from a project to another, like a custom task, then use a svn:externals in each project pointing to a ruby file that the buildfile requires.