2

I am developing a java library, which will be released in maven central. My project depends on few others, the dependencies look something like this:

<dependencies>
     <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
         <version>1.7.32</version>
     </dependency>
     <dependency>
         <groupId>org.junit.jupiter</groupId>
         <artifactId>junit-jupiter-api</artifactId>
         <version>5.8.2</version>
         <scope>test</scope>
     </dependency>
</dependencies>

For the last few days i am hindered by handling the licenses of these dependencies.
SLF4J for example is MIT licensed and the license states - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. How exactly should i include the SLF4J license in the artefacts? Do i even need to include it, considering that normally artefacts don't contain their dependencies?
Similarly i am not sure how to handle test dependencies, do i need to include licenses and agreements for them, considering they are only used during the test stage of builduing asrtefacts?

1 Answer 1

3

As you noticed, the MIT license requires that its text be included in all "copies or substantial portions of the Software". So, if you distribute a copy of part or all of SLF4J, either on its own or as part of some larger program or package, you need to include the MIT license with that distribution and indicate that the license applies to the copied part. But if whatever you distribute does not include SLF4J itself, the MIT license does not impose any requirements on that distribution: you wouldn't have to include the copyright notice and license text for SLF4J in a distribution that does not actually contain SLF4J.

The same goes for any other dependency covered by the MIT license. Other licenses might have some requirements you need to fulfill even if you're not distributing the dependency itself, though. The classic example is the GPL, which requires that the dependent software (i.e. your program that depends on a GPL library) also be licensed under the GPL - at least, it probably does, depending on just how tight of a dependency it is.

See also Do I need to include the license for all dependencies declared in a setup.py? which is much the same question in the context of Python instead of Java (but the language doesn't matter).

6
  • "and indicate that the copied part is covered by that license" depending on how you define "is covered by", I'm not sure I agree with you. Do you mean that (a) the terms of the MIT license continue to apply to use of that code, though others may also, or that (b) the MIT license continues to represent the complete set of terms that apply to the use of that code?
    – MadHatter
    Dec 31, 2021 at 9:24
  • (a) not (b). Or more precisely, when I wrote "covered by", I meant only that the terms of the MIT license apply to that part of the software; I didn't mean to imply anything about whether other terms might also apply. It didn't occur to me that the phrase might be interpreted that way. (I could edit if that's not clear.)
    – David Z
    Dec 31, 2021 at 19:47
  • No, the clarification is fine by me, and I thank you for it.
    – MadHatter
    Jan 3 at 9:29
  • @DavidZ Thanks for the answer, it was quite usefull, especially that python question, somehow i had missed it. I still need to dig through the rest of the licenses(a mix of MIT, AL v2.0 and EPL v2.0, there is no GPL) to check the requirements. I am still not clear how to add agreements or source, in case it's needed. After lots of digging, i could not find any definitive information, the best i could come up with for licenses (combination of few other ideas i found) is creating licenses directory in project resources and inside license-lib1.txt, license-lib2.txt, etc.
    – Chaosfire
    Jan 3 at 15:56
  • @Chaosfire There are probably other questions on this site that could help you out there, or if you can't find any, you could ask a new one.
    – David Z
    Jan 3 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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