2

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?

z_blue
  • 350
  • 3
  • 20
Bruno
  • 55
  • 1
  • 1
  • 5
  • please note that the link with the instructions you posted as part of your question no longer works. – panza Jul 05 '17 at 13:43
  • Follow this: https://stackoverflow.com/questions/18736986/autocompletion-of-author-in-intellij – Ramnath Jul 20 '18 at 02:57

1 Answers1

1

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.

Bas Leijdekkers
  • 23,709
  • 4
  • 70
  • 68
  • Thanks, I will use the hardcode which is fine for now but some other people will join the project later. I noticed that the File Header.java – Bruno Nov 28 '15 at 11:01
  • Thanks, I will use the hardcoding solution which is fine for now but some other people will join the project later so it won't be a long-term solution. I'm searching a way to declare a template that can be shared by other project team members. It's important that the author name is correct and not just the system login. I noticed that the template was saved in C:\Users\{USER}\.IdeaIC15\config\fileTemplates\File Header.java and not in the project .idea directory. Is it possible to create a template which is in the git scope so it can be shared by the team? – Bruno Nov 28 '15 at 11:24
  • @bruno In the File and Code Templates settings, in the upper right corner is a dropdown menu. This you can set to Project to save your templates your project files. – Bas Leijdekkers Nov 29 '15 at 13:20