Copyright Profiles
Profiles Toolbar
Item | Tooltip and Shortcut | Description |
|---|---|---|
Alt+Insert | Add a new profile. | |
Alt+Delete | Discard the selected profile. | |
Ctrl+D | Open the Copy Copyright Profile dialog, where you can create a copy of the selected profile. | |
Import | Import a file that contains a copyright notice definition. For more information, refer to Import a copyright profile. |
Copyright Profile Page
Use this page to configure the selected profile: define the copyright notice to be generated and specify the keyword to detect copyright notices in comments.
Item | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Name | Use this text field to view or edit the name of the selected copyright profile. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Share through VCS | Select this checkbox to store the profile in the .idea directory and share it with your team through VCS. If you clear the checkbox, IntelliJ IDEA stores the profile on the IDE level and applies it to all projects. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright text (may contain Velocity templates) | Use this text area to view or edit the copyright notice to be generated. A copyright profile can contain an explicit plain text of the copyright notice or its definition through a Velocity template. Currently, the following variables are available in the Velocity context:
For example, the following template inserts the current year and the name of the current user:
Copyright (c) $today.year $username
To keep the original year and update only the last one, for example, to change
Copyright (c) $originalComment.match("Copyright \(c\) (\d+)", 1, " - ", "$today.year")$today.year $username
In a new notice, this template inserts only the current year, for example, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Validate | Click this button to check that the Velocity template has been specified correctly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Regexp to detect copyright in comments | Use this field to type, view, or edit the regular expression that will be used to find copyright notices in comments. Note that this regular expression should match the copyright notice specified above. Otherwise instead of updating copyright notices, IntelliJ IDEA will insert new ones. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Allow replacing copyright if old copyright matches | Optionally, specify a regular expression that limits which existing copyright notices IntelliJ IDEA updates. IntelliJ IDEA replaces a detected notice only if this expression matches some part of its text. The expression is case-sensitive. If you leave the field empty, IntelliJ IDEA replaces all detected notices. For example, to update notices of your company and leave the notices in third-party code unchanged, specify the company name: Note the difference between Regexp to detect copyright in comments and Allow replacing copyright if old copyright matches. The first setting finds copyright notices, and the second one decides whether a found copyright notice is updated. |