0

我有这个定义:

private static final String REVISION = "$Revision: 496 $"

对于部署来说效果很好,但是当我调试时,我会这样做:

private static final String REVISION = "$Revision: 496 $" + "v1";

因为在使用 SVN 签入之前,rev 不会改变。

我包括在内的原因v1是我想确保我的 jar 已更新并且一切都已完成。

任何更自动化的说法,包括构建日期/时间

看着阅读清单,似乎参与其中。

Ant 的替换方法似乎是最好的:

private static final String REVISION = "$Revision: 496 $" + "@datetime@";

然后@datetime@在 Ant 中定义。

我应该使用 Eclipse 吗?

4

1 回答 1

0

Looked at reading manifest, seemed involved.

I don't know if this is "more automated" or "less involved", but my preference for handling runtime accessible version numbers is to put them into a property file that can be read via the classpath. This has the advantage that the Java source code that you compile is identical to the source code in your sandbox ...

I don't think Eclipse is relevant to the problem. Eclipse is an IDE not a build tool. Besides, you can easily configure it to do builds using Ant and your Ant build files.

于 2012-07-30T14:31:41.053 回答