开发者

Can you use Eclipse's .Project files variables for Code Style variables?

I want a way to have my code style do something like this.. this comment is in PHP but the concept should work for any eclipse compatible language.

/*
 * @author ${user}
 * @version ${version}
*/

I would want to update the version variable once, then commit to the repository. So, now when others add comments it would include the Version. This is where the issue comes.. where do you store the Version? Can I just create a <version></version> set of tags in the '.project开发者_运维技巧' file and some how reference them from the code styles?


In this kind of situtation, provided you are using Subversion, I would use its Keywords substitution mecanism (quoting) :

Subversion has the ability to substitute keywords—pieces of useful, dynamic information about a versioned file—into the contents of the file itself. Keywords generally provide information about the last modification made to the file.

Here, you'd probably be interested by the keywords Revision, and Author, I suppose :

Revision
This keyword describes the last known revision in which this file changed in the repository, and looks something like $Revision: 144 $.

Author
This keyword describes the last known user to change this file in the repository, and looks something like $Author: harry $.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜