-
Notifications
You must be signed in to change notification settings - Fork 3
Home
This is a plugin for Eclipse that provides additional template variables to JDT code templates.
With this plugin you can use additional variables in your JDT code templates (e.g. Window > Preferences > Java > Code Style > Templates > Code Templates).
-
${project_version} refers to the current version of your m2e project but excluding any -SNAPSHOT.
-
${project_artifactId} refers to the current project artifactId of your m2e project.
-
${project_name} refers to the current project name of your m2e project.
The most common use-case is to add the following to the JavaDoc of your type-comment:
@since ${project_version}
So new types created with Eclipse automatically carry the version of your project that introduced the new type.
Further, eclipse already provides the ability to define and manage key/value pairs in Window > Preferences > Run/Debug > String Substituion. This plugins makes these key/value pairs available as variables so you can use them in JDT code templates.
So you can e.g. define the variable author with the value you like to have. Then you can use ${author} instead of ${user}. Instead of tweaking the system properties and faking your user.name what is actually a bad hack you can now just change the value of author in the preferences. Simply change your code-templates to use this line:
@author ${author}
Advanced users will only need the Update Site.
-
From the Menu select Help > Install New Software...
-
Click on the Add button
-
Enter templatevariables for Name
-
Enter https://m-m-m.github.io/eclipse-templatevariables/latest for Location
-
Confirm with OK button
-
Wait a moment (ensure templatevariables is entered for Work with)
-
In the selection area expand mmm Tools and check mmm-TemplateVariables
-
Click on Next
-
Click on Next again
-
You need to read and confirm the license agreement
-
Then click on Finish
-
Wait a while
-
Confirm the security warning about unsigned content with OK
-
Confirm to restart Eclipse with Yes
-
Wait until eclipse is restarted
-
Enjoy the new plugin