Question

I adapted some code from the Apache Ant project in my work. The part I used is really small: ~70 lines, ~2000 characters. Adding dependency to ant to use that a single method seemed like an overkill.

The project I work on is internal to the company, so I initially included a javadoc like

    @see <a href="...">original source</a>

for my colleagues to know the code wasn't mine.

Then I encountered this summary at tldrlegal which states that this is not enough, and to do this properly I have to do much more:

  • Include Copyright
  • Include License: Including the full text of license in modified software.
  • State Changes: Stating significant changes made to software.
  • Include Notice: If the library has a "NOTICE" file with attribution notes, you must include that NOTICE when you distribute. You may append to this NOTICE file.

From this I deduce that I actually have to include NOTICE file from ant (it's like 10 lines), somehow redistribute Apache 2 license text with the project, and include a monster comment like this before the function body or before the beginning of my class:

   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Is there a more compact but still correct way to do it, or is there no other way? Introducing lots of changes because I only use a minuscule part of the project (namely, a single ~70-line method) will negatively impact code-review quality and maintainability of the final code.

P.S. I don't seek professional law advice, just some common-sense-based guidelines for this situation, preferrably with examples from other open-source projects.

Was it helpful?

Solution

The easiest way to get around it is to document what you need the function to do, and then give that specification to your coworker and ask them to re-write it. Seventy lines isn't a ton to rewrite, but if you were to rewrite it right now you'd know how Apache did it and possibly (unintentionally) copy their code or way of doing it. If you think the Apache code is so great that you would rather have their code, you have to play by the full set of rules you already outlined - there's not really a way around it.

OTHER TIPS

I ultimately chose to add Ant (org.apache.ant:ant) as dependency and pack it into uberjar with maven-shade-plugin. This way original code is re-used (which was my goal), and license-maven-plugin can download all project dependencies' licenses automatically. There is a small drawback of increased uberjar size, but it is negligible (~2 Mb for ant 1.9.4).

Some comments on my original approach:

  • As per point 4 of the Apache 2.0 license, a copy of the license must be included. NOTICE file must be added as well, because ant already has it. So there is no "more compact but correct way" that I searched for.
  • Copying the original Commandline class verbatim, or adding Commandline class with appropriate license comment and only the methods I used offers better readability than adding license comment above the copied method's body.
Licensed under: CC-BY-SA with attribution
scroll top