Cannot resolve variable PACKAGE_NAME with Intellij Ultimate Velocity editor/plugin

25 views Asked by At

I am trying to write a Velocity Template in Intellij Ultimate, which includes plugins for Velocity. However I already run into issues on this simple example:

package ${PACKAGE_NAME}

enter image description here

I don't understand why I am getting an error here. My final goal is to write a file template for Android Studio in Intellij Ultimate, as it includes plugins for Velocity. I want to copy over the finished template to Android Studio.

1

There are 1 answers

0
Jacky Liu On

these files are not intended to be edited in a plain Java/Velocity project, you should edit them in the "File and Code Templates" Window.

Before we begin editing, let's learn how to access the Templates window. There, we can find all existing templates and also create our own.

Steps:

  • Right-click on any file/package
  • Navigate to "New"
  • Click on "Edit File Templates..."

You should be presented with a window that looks like this.
Alt Text

For more info, please refer to these pages: https://dev.to/wilderminds/how-to-use-android-studio-file-templates-to-speed-up-development-4e93

https://developer.android.com/studio/write/create-java-class#templates