I have a file header template which includes a @author ${USER}
. However when I create a new java class in IntelliJ, only my first name appears, probably because my system user login is just my first name. I applied the following instructions (basically adding -Duser.name=Firstname Lastname
in idea.exe.vmoptions
) in order to have both my first and last name instead, and it works. However this parameter is not only used by this template and make for example some plugins break because of the typical invoking line command:
"C:\Program Files\Java\jdk1.8.0_60\bin\java" -server -Xms128m -Xmx512m
-XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow-Duser.name=Firstname Lastname
etc…
This command complains about not finding the class Lastname
because IntelliJ adds all arguments in idea.exe.vmoptions
which include -Duser.name=Firstname Lastname
but this breaks the arguments chain because of the space in the user name…
Any idea on how to change the author name without breaking anything?
Best Answer
You could just hardcode your name in the template
@author Bruno XXX
. If needed you may want to create an include template containing your name and reference it from all needed templates#parse("author.txt")
There is also this feature request IDEA-145370 Configure custom author name/email/organization to be used in file templates, completion etc. You may want to vote for it.