Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change @author tag configuration in eclipse in such a way that it takes the name I have specified?

I'm using Eclipse Indigo for Java.

I used to write comments over the methods. In that whenever I use @author tag, it automatically takes the username of the system who is currently logged in.

My question is : How can I change this @author tag configuration in such a way that it takes the name I have specified.

I have gone through the following link:

How to change the value of ${user} variable used in Eclipse templates

But it suggests to change the value of classpath variable $user. I don't want to do that. I want to change comment template through configuration.

like image 523
RAS Avatar asked Dec 20 '12 08:12

RAS


People also ask

How do I change the author tag in eclipse?

Simply go to: Window - Preferences - Java - Code Style - Code Templates - Comments - Types - Edit... and change ${user} to whatever you want. Also go to: Window - Preferences - Java - Editor - Templates - @author - Edit... and change ${user} to whatever you want.

How do you write author name in Eclipse?

Shift + Alt + J will help you add author name in existing file.

How do I change the author in Netbeans?

Go to Tools -> Templates. Click on Settings button. A new panel with template settings will appear in your IDE: Uncomment the last line and change the value of "user" to what ever you like to be inserted after the @author tag.


2 Answers

In the eclipse directory there is a file named: "eclipse.ini" open the file and add following line:

-Duser.name=desired name 

after the "-vmargs" line

like image 29
bdogru Avatar answered Oct 13 '22 09:10

bdogru


There are several ways of accomplishing this. Open up Eclipse Preferences, type in Templates as your Filter, then select Java->Code Style->Code Templates. In the Code Templates widget, expand the Comments widget:

Eclipse Preferences - Java Code Templates

Looking through the expanded selection, you can see that there are templates defined for Types and Methods, amongst others. Select whichever template you want to edit, then click 'Edit'. You can now change the template as you see fit, for example by adding @author ${user} or whatever else to it:

Eclipse Preferences - Java Code Templates - Methods

Click 'Ok' out of all the dialogs to complete and save.

like image 126
Perception Avatar answered Oct 13 '22 07:10

Perception