有没有办法在 Eclipse 中提交之前执行 ant 目标?
我们有一个包含存储库当前全局修订版的构建属性文件。该文件是在有人标记该项目之前手动更新的。
我的想法是编写一个 ant 任务来更新属性文件中的修订号,并在 eclipse 中设置一个项目构建器来执行该任务。但问题是,您只能选择在清理之前或之后运行任务,或者在手动或自动构建时运行任务。
有没有办法在提交之前执行目标,以确保修订号始终更新?
We have a build properties file with the current global revision of the repository. This file was manually updated before someone tagged the project.
My idea is to write an ant task which updates the revision number in the properties file and set up a project builder in eclipse to execute the task. But the problem is, that you can only choose to run the task before or after a clean or on a manual or auto build.
Is there a way to execute the target before a commit, to ensure that the revision number is always updated?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让您的版本控制工具完成工作,这是他的职责。
以下是使用 cvs 关键字< 的构建文件标头示例/a> 使用 cvs 或 cvsnt 时。
您可能之前在多个来源中看到过这一点,因为这是一个很好的做法。
其他版本控制工具,如 subversion .. 等也具有类似的功能,只需检查它们手册,
参见Subversion、关键字替换
cvs 元信息会在每次提交时自动更新,并且您不会忘记。
将这些关键字放入文件模板中你的编辑就完成了
但是要注意,您的 difftool 将显示每个文件的差异,即使只有修订号由于分支而发生了变化。如果我使用 Eclipse,他们的 difftool 不够智能,无法忽略那些关键字等特定部分
(仍在等待插件来修复该问题..)。但一段时间后你就会习惯;-)
在团队中工作时,在由于差异问题而发生冲突之前,必须就是否使用关键字达成一致。
Let your versioning tool do the work, it's his part.
Here's an example for a build file header that makes use of the cvs keywords when using cvs or cvsnt.
You might have seen this before in several sources, as it is good practice.
Other versioning tools like subversion .. etc. have similar features, just check their manuals,
f.e. see Subversion, keyword substitution
the cvs meta informations get updated automatically with every commit and you can't forget.
put those keywords in the file templates in your editor and you're done
But beware, your difftool will show differences for every file, even if only the revision number has changed because of branching. f.e. i use Eclipse and their difftool is not smart enough to ignore specific parts like those keywords
(still waiting for a plugin to fix that..). But after some time you will get used to ;-)
When working in a team, there has to be an agreement about using keywords or not before conflicts occur because of that diff problem.