18

Reading through the Apache Software License 2.0 appendix I am left unclear what exactly I have to do now:

APPENDIX: How to apply the Apache License to your work

To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.

To explain a bit more: I am currently contributing to an open-source project on github, where the decision to license under ASL2.0 was made. In the latest commit, the license text was added as LICENSE to the root directory.

The interesting part is now: What else has to be done to fully license the code under Apache Software License. In specific: What is considered "work" and is it mandatory to include the boilerplate notice to each and every source-file in the project?

I figure it should be possible to add the notice to the already existing README, as I have seen it in other open source projects. Something along the lines of:

License:

Unless explicitly stated otherwise all files in this repository are licensed under the Apache Software License 2.0 [insert boilerplate notice here]

I think that should be okay, because the Apache Policy on Source Headers (even though intended for Apache Software Foundation owned projects only) states:

Each original source document (code and documentation, but excluding the LICENSE and NOTICE files) SHOULD include a short license header at the top. If the distribution contains documents not covered by CLA, CCLA or Software Grant (such as third-party libraries) then see the policy guide.


  1. Each source file should include the following license header -- note that there should be no copyright notice in the header:

Specifically the "should" here makes me think, that a license header in every file is not mandatory for each and every source-file of a project licensed under ASL.

5
  • 1
    Do you have any objections to simply including the header in each source file? Jan 14 '15 at 19:36
  • 1
    Well it's a hassle :( Additionally a possible relicensing is made unnecessarily complicated with that and I have a personal "grudge" against license headers.
    – Vogel612
    Jan 14 '15 at 19:38
  • 2
    Meh. A license change is a Find and Replace operation across all files, in any IDE worth its salt. Jan 14 '15 at 19:42
  • You could also just include a short statement in each file such as "This project is licensed under the XYZ license. For details see the LICENSE file which can be found at the base of this project archive" or words to those effect.
    – Brandin
    Oct 6 '15 at 8:08
  • 2
    No, it is not necessary: apache.org/dev/apply-license.html#copy-per-file But as Jules states below, if a file is viewed or reused in isolation, the license will be evident
    – Steen
    Apr 6 '17 at 9:05
21

No, it is not necessary to include the license in every file. This is a recommended practice, because it ensures that if somebody is viewing one of the files from your project in isolation from the rest they will be able to identify the terms of use for it, but in the end, as long as you do something that makes it clear what the intended license terms are, that is enough, legally speaking.

(Note that this is not legal advice; if this is important you should seek advice of a lawyer in your jurisdiction, etc.)

5

It was already mentioned in the comments, but to make it more visible, repeating the section from the Apache Software Foundation FAQ here (it might have been added later on).

DO I HAVE TO HAVE A COPY OF THE LICENSE IN EACH SOURCE FILE?

Only one full copy of the license is needed per distribution. See the policy.

http://www.apache.org/dev/apply-license.html#copy-per-file

3
  • This doesn't answer the question. The OP asks about license header inclusion in each file, not about copying of the license to each file. And, this answer doesn't contain an answer to OP's question.
    – kravemir
    Mar 27 at 7:44
  • 1
    @kravemir - I think the question was precisely about the requirement of having the license header in each file. That's why I added this as an answer. If you have a better answer then next time maybe consider sharing your knowledge instead of downvoting :) Mar 28 at 21:22
  • 1
    Well, (down)voting represents (non)usefulness of answer. So, rather focus on improving yours and see votes as indicator of (not)doing so. Downvoting is about helping future readers to filter out non-answers. Yours answer doesn't even contain any of "yes", "no", "should", "must", 'shouldn't", etc (regarding inclusion of header in source files). The citation you've posted is about including license file with distribution vs full copy within the source file. However, the OP asks about including header in source files.
    – kravemir
    Jun 27 at 8:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.