How do I set ${user} in Eclipse to get the correct @author tag?

Viewed 83017
2 Answers

I'm not sure if there's a way in Eclipse itself. But from what I can find, ${user} uses the value of the user.name environment variable; therefore, you can pass -Duser.name=My Name in eclipse.ini to override it.

Or, if you prefer, you can modify the shortcut to point to:

C:/java/eclipse/eclipse.exe -vmargs -Duser.name="cleverUserNameToUseInSourceCode"

as shown in this blog entry.

@author ${user}

Windows > Preferences > Java > Code Style > Code Templates > Comments

Select Types and edit the template to insert another value (possibly a fixed one for now, or change the user.name property as mmyers suggests)

/**
 * @author myUserValue
 *
 * ${tags}
 */

Code Template preferences

Related