简体   繁体   中英

adding java debug in comment ant vs eclipse vs java

I have this defined:

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

Works great, for deployments, but when I debug I do this:

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

Because the rev is not changing until checkin with SVN.

The reason I include v1 is I want to make sure my jar was updated and everything took.

Any more automated way of say including build date/time ?

Looked at reading manifest, seemed involved.

Ant's replace method seemed the best:

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

Then define @datetime@ in Ant.

Should I use Eclipse?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM