Introduction #

It is a pain to manually update copyright messages in open source code that you’re going to release on GitHub 😩. There is a better way. You can have JetBrains based IDEs (Android Studio, Webstorm, etc) just do it for you.

I’m going to use Android Studio as an example, but this works on Webstorm, etc.

Open Android Studio and follow these setps in order to automagically generate copyright messages for all your project files.

  • Open Preferences, and navigate to Editor -> Copyright -> Copyright Profiles.
  • Create a new profile and name it android.
  • Paste the following text into the dialog box, replacing the default text that’s already there.
Copyright $today.year YOURCOMPANY. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
  • Make sure to replace YOURCOMPANY with your name or the name of the company that the copyright belongs to.
  • The $today.year snippet is a Velocity template string that just inserts the current year into the copyright message when it’s updated.
  • Click on OK.

Step 2 - Create a scope to apply the android profile to #

  • In Preferences, navigate to Editor -> Copyright.
  • Apply the android profile the default for the project.
  • Add the Project Files scope and apply android to it.
  • Click on OK.

Step 3 - Tell Studio to apply this to all the files #

  • Right click on your project’s root and select Update Copyright ....
  • Make sure to apply this to the Whole project and Update existing copyrights.
  • Click OK.

  • When you commit your changes using Android Studio, you can just check the Update Copyright so that the changed files will have their copyright messages updated.
👀 Watch Rust 🦀 live coding videos on our YouTube Channel.

📦 Install our useful Rust command line apps using cargo install r3bl-cmdr (they are from the r3bl-open-core project):
  • 🐱giti: run interactive git commands with confidence in your terminal
  • 🦜edi: edit Markdown with style in your terminal

giti in action

edi in action

Related Posts