Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA override $user

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.

like image 332
Pr0gr4mm3r Avatar asked Oct 27 '13 13:10

Pr0gr4mm3r


People also ask

How do we override a method from the superclass?

When overriding a method, you might want to use the @Override annotation that instructs the compiler that you intend to override a method in the superclass. If, for some reason, the compiler detects that the method does not exist in one of the superclasses, then it will generate an error.

How do I know override method?

Use the MethodInfo. GetBaseDefinition method to determine which method is overridden in what base class. The following overloaded method, FindMethodOverrides , examines all of the static and public instance methods in a class and displays which methods override their respective base class methods.

Can an object's method be overridden with a custom implementation on runtime?

As others said, no, you can't override a method at runtime.


1 Answers

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}.

like image 99
Pr0gr4mm3r Avatar answered Sep 27 '22 22:09

Pr0gr4mm3r