Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get system user in ant (within eclipse)?

Tags:

java

eclipse

ant

How can I access the name of the system user (which eclipse also uses for the javadoc author tag) in my ant build file?

I'm trying to show some information about the current program version in my java application. I decided to use jreleaseinfo which passes variables from my ant build script to my java classes (to show them in a window). With svnant I'm even capable of accessing the latest revision number and build date from svn within my build.xml.

Now: The last thing I need is to show who made that build!

like image 512
räph Avatar asked May 08 '09 07:05

räph


2 Answers

This will work anywhere. It uses the java system property user.name.

<property environment="env" />
<echo message="user: ${user.name}" />
like image 170
Persimmonium Avatar answered Sep 30 '22 18:09

Persimmonium


user.name can be used:

<echo>User is: ${user.name}</echo>

Results in:

[echo] User is: coobird
like image 30
coobird Avatar answered Sep 30 '22 19:09

coobird