Skip to main content

IntelliJ Copyright Profile for Android

·225 words·2 mins

One of things that I keep finding myself doing is creating copyright profiles in IntelliJ for my open source projects. If I move to a new machine, I have to do it all over again. So I thought I’d write a quick blog post, more for my reference than anything but hopefully you’ll find it helpful too.

Scope
#

The first thing you need to do is create a ‘Scope’. This is basically a filter of files within your project which the copyright profile should update. For Android projects I the following filter, which updates only files in my src and res directories:

file:src//*||file:res//*

You also need to make sure that you check the ‘Share Scope’ button at the bottom is checked.

scope

Copyright Profile#

Now we need to create the actual copyright profile. Expand the ‘Copyright’ menu item and click on the ‘Copyright Profiles’, then add a new Profile. For instance I have an Apache v2.0 profile as all of my open source code is licensed that way.

copyright_profile

Link Scope & Profile#

Now you need to go back to main Copyright page and link the scope with the profile. Just make sure that you keep the “Default project copyright" as “No copyright". If I set that then IntelliJ seemed to use the ‘all’ scope rather than my ‘src+res’ scope when updating the copyright.

copyright_profile_2