IntelliJ IDEA 11.1 Web Help

A file template can contain template variables. When a template is applied the variables are replaced with their values.

A file template variable is a string that starts with a dollar sign which is followed by the variable name. The variable name may be enclosed in braces. For example: $MyVariable or ${MyVariable}.

In this section:

Predefined template variables

IntelliJ IDEA comes with a set of predefined template variables.

The available predefined file template variables are:

  • ${PACKAGE_NAME} - the name of the target package where the new class or interface will be created.
  • ${USER} - login name of the current user.
  • ${NAME} - the name of the file that will be created.
  • ${DATE} - the current system date.
  • ${TIME} - the current system time.
  • ${YEAR} - the current year.
  • ${MONTH} - the current month.
  • ${DAY} - the current day of the month.
  • ${HOUR} - the current hour.
  • ${MINUTE} - the current minute.

Custom template variables

In addition to the predefined template variables, it is possible to specify custom variables. If necessary, you can define the values of custom variables right in a template using the #set VTL directive.

For example, if you want to use your full name instead of login name, use the following construct:

#set( $MyName = "John Smith" )

If when applying a template, and the values of certain template variable are not known, IntelliJ IDEA will ask you to specify those values.

See Also

Concepts:

Procedures:

Reference:

Web Resources: