7

For technical reasons (classloader issues), I need to rename the packages of the compiled version of an Apache library when I build my application, (which includes my code and the Apache code, a so-called fat jar). There are Maven and Gradle plugins to achieve this, (Maven shade plugin or Gradle shadow plugin).

This means, that the bytecode is modified so that the qualified name of a class is not org.apache.commons.lang3 any more, but something like shadow.org.apache.commons.lang3.

Now the license requires:

You must cause any modified files to carry prominent notices stating that You changed the files;

This is my problem, I only change the bytecode so there is no (sensible) way to put a notice in there, at least not in a readable form.

What can I do?

  • 2
    Suppose for a moment that you made no changes to those files. Are you currently adding a notice as to the license of the library you are including? I.e. how are you currently complying with the notice requirements of the Apache library, independent of your "changes"? – Brandin Sep 19 at 8:36
  • 1
    Currently, the jar contains a folder with all the licenses for the different included external jars. – J. Fabian Meier Sep 19 at 18:11
3
+25

You may not be able to follow that requirement to the letter, but you can adhere to the intent of the requirement.

The intent is that recipients of your version of those libraries are informed that changes have been made compared to the version you received. To comply with the intent of the requirement, you should put a notice in a location where your users are likely to see it.

I would recommend to mention in the documentation of your application, where you mention that you are using library, that you have shaded/shadowed the names of the library using the shade/shadow plugin of Maven/Gradle.

While not following the license requirements to the letter may be seen as a license violation, I believe that if you take a reasonable effort to fulfil the intent of the requirement, then no judge will actually rule it as a license violation. Sometimes, it is technically impossible to follow the requirements to the letter.

  • 1
    Not following the requirement, is a violation of the license, is it not? – Lucas Ramage Sep 26 at 13:12
  • The question title asks whether or not it is a violation; I would reword your answer to state that either 1) It is, but here are steps to remedy this, (which is close to what you have now); or 2) It is not, and this is why. – Lucas Ramage Sep 26 at 14:02
2

Does renaming compiled Java packages violate the Apache license?

No, as long as you provide appropriate notice.

This is my problem, I only change the bytecode so there is no (sensible) way to put a notice in there, at least not in a readable form.

You do not need to put the notice in the bytecode. You simply need to inform your users that you have modified the work.

Per the Apache 2.0 license,

You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works

The license specifically mentions modified files, and the intent here as seen in the clause above is for you to provide notices in Source form.

While the other answer, already provides a clear solution for how to accomplish this, it is not quite accurate regarding the requirements of the license.

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.