2

Without loss of generality, suppose you have an open source Java project with Gradle as the build system, and you want to add the MIT licence to it. Consider the cases:

Case 1. From the build.gradle file you decleare a depedency on JUnit5 which is licenced under Eclipse Public License - v 2.0. You make a few tests with it in a test folder, and all that along with a src folder is uploaded on GitHub. Can your project be licenced under MIT? Furthermore, you will create a package with your project, but the JUnit5 tests will not be included in it.

Case 2. From the build.gradle file you decleare a depedency on java-annotations from JetBrains, which is licenced under Apache License 2.0. Can your project be licenced under MIT? Furthermore, you will create a package with your project, and you want the dependeds to view the annotations on your code, but you are not concerned if they can use the annotations in their code.

TL;DR: I understand that if you copy and paste the files of a project you can only re-licence it with compatible licenses, but does the same hold true if you only depend on them via Maven/Gradle packages and your produced project package will not contain them?

2
  • Copyright doesn't apply if you don't copy (and distribute) anything. If you just add something as a dependency, but don't include the source (or binaries) in your project, then you haven't copied anything and can therefore use whatever license you want for your own code.
    – Felix G
    Aug 18, 2020 at 7:43
  • Your code can. Their code can't. Unless their license is GPL in which case your code might have to also be GPL.
    – user253751
    Aug 18, 2020 at 9:55

1 Answer 1

1

When you declare a dependency on package X, there are two possibilities

  1. Package X has a strong copyleft license, like the GPL or AGPL: These licenses have the requirement that the final binary application is licensed under respectively the GPL or AGPL license. As a result, they put a restriction on the licenses you can choose for your own code.

    Any build you distribute that contains package X must be licensed under the same license as package X. If there are no builds without package X, then it is best to license the source code also with that same license. If you also have builds without package X, then you can choose a compatible license for your source code.

  2. Package X has any other license: These licenses do not extend their scope beyond the files that are explicitly licensed with that license and thus they don't put any restriction on the licenses you can choose for your own code.

    In this case, you can use a less restrictive open source license, a more restrictive open source license or even a closed-source license that is compatible.

Both cases you mention (JUnit5 and java-annotations) involve licenses in the second category and thus they don't affect the license choices you have for your own code.

4
  • You mean that you can use an Apache License 2.0 library and have your project under MIT? Isn't the other way around only possible?
    – user20241
    Aug 18, 2020 at 10:48
  • 1
    Yes, you can have your project under the MIT license while using an Apache 2.0 dependency. Only when distributing a binary containing both, you need to have the appropriate license notices and the additional attribution notices required by the Apache dependency. Aug 18, 2020 at 11:13
  • If you write your own code specifically to fit the API offered by Package X, doesn't that make it a derivative work, meaning you'd have to comply with the package X license to distribute it?
    – bdsl
    Sep 5, 2020 at 17:45
  • @bdsl, yes, but complying with a license does not imply that you use the same license. This holds especially for permissive licenses. Sep 6, 2020 at 7:08

Your Answer

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