I need to copy a method from an Apache licensed Javascript library into my GPL licensed javascript library.

Can I copy and paste the method into my library in this license context? If so, how am I to include the proper Apache license details?

Or do I need to save the method in a separate file and include the Apache license there?

1 Answer 1


The solution that is the easiest to understand for everyone is to have the function that comes from the Apache licensed library in a separate source file.
Then you can just use the normal copyright and license comments, as appropriate for the license of that file, at the top of each file.

It is possible to have both portions in a single source file.
If you choose this route, then you must make it clear at the top op the file that some functions are also under another license.

Then, next to the functions that are under the Apache license, include the Apache license comment there.

As in this case the copyright on parts of your source file are owned by the copyright holders of the library from which you included a function, you need to add their copyright statement also to the copyright statement of your file.

  • 1
    Thanks Bart, I will accept your answer. But just a small question for the first scenario. Even if I saved in a separate file, I have to use the name of the library and the method in my source file. As an example: ApacheLibrary.method();. So, do I have to add again Apache comments above that ApacheLibrary.method(); line in my source file? Mar 7, 2016 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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