IntelliJ IDEA override $user

2019-03-28 03:18发布

问题:

It's a quite simple question, but I can't find an answer to it using SO-Search and Google.

Is it possible to override the default $user VTL-variable used in file-templates globally, instead of setting it in each template with #set($user = "...") ?

Like some sort of setup-script for IntelliJ itself, where I can alter the value?

Thanks in advance.

By the way, I'm using IntelliJ Ultimate 12.1.6.

回答1:

You want to modify the IntelliJ's .vmoptions file(s) in a text editor.

  • In Windows, edit IntelliJ-Install-Location/bin/idea.exe.vmoptions and/or IntelliJ-Install-Location/bin/idea64.exe.vmoptions.
  • In Mac OS X, edit IntelliJ-Install-App.app/Contents/bin/idea.vmoptions.

Within these files simply add or modify the following line:

-Duser.name=Your name

If you recognize this syntax, that's because Intellij IDEA uses the Java System Property user.name to fill $user and ${USER}.