Reuse a small method from Apache Ant: How to do that correctly

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.

3

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.

4

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.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Reuse a small method from Apache Ant: How to do that correctly

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.

3

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.

4

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.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật