深度解读Apache License 2.0及其使用方法

一张ai生成具有多个文件的文件夹图片
开源授权内容详解

LICENSE 许可证,使用什么许可证,表示你遵循这个许可证授权方式。

什么是License

许可证混乱就始于你不知道License到底是什么,到底有什么含义。当你对你的产品使用License时,并不意味着你放弃了任何权利,你依然对其拥有原著作权。License只是授予他们于特定权利来使用你的产品。

License只是把你的作品释放到公有领域,或者给各个拷贝赋予权限。也意味着你放弃了版权收入,别人也没有义务把你列为原作者或贡献者。

开放源代码许可协议更容易为他人作出贡献,而不必寻求特别的许可。它也可以保护你作为原创者的权利,至少确认了你的贡献。它还可以保证你的工作不为别人所剽窃。

使用Apache License 2.0 许可证

在项目中放入LICENSE文件,一般Github 仓库建立的时候,会直接选择这个证书。

本项目使用 Apache License 2.0 (opens new window)协议,请严格遵照协议内容

具体的作用

1)如果你修改了代码,需要在被修改的文件中说明。

2)在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明。

3)如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。

4)Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售

5)你可以修改包名或类名,但还请保留文件中的版权和作者信息。

用一句话概括Apache License就是,你可以用这代码,但是如果开源你必须保留我写的声明;你可以改我的代码,但是如果开源你必须写清楚你改了哪些;你可以加新的协议要求,但不能与我所公布的协议要求产生冲突;你用这代码干什么我不管,但是你不能让我承担任何责任。

各种开源协议的不同之处对比

开源协议.png

根据授权方式和使用方式特性,进行划分源代码,添加对应的协议即可。

中文翻译网站:https://qastack.cn/software/19649/copyright-notices-disclaimers-in-source-files

通常会在源文件中放置版权声明和法律免责声明,有时甚至在开源项目的每个源文件中都有完整的许可协议。

一般也会在每个源文件中放置协议说明。如下!

Copyright [yyyy] [name of copyright owner]

  Licensed 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.

具体的使用方式

详细解释各个协议内容和如何使用,参考:https://opensource.org/licenses

image-20210614233534831

image-20210614233550800

Copyright [yyyy] [name of copyright owner]

  Licensed 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.

这是Apache License 2.0 用法。将代码文字以注释的形式,张贴复制到每个代码文件中即可。

如何使用Apache License 2.0 许可证

1)建立项目的 使用使用git 添加LICENSE 许可证。

2)在每个源代码的添加上以上格式。

参考

[1] https://bbs.huaweicloud.com/forum/thread-68115-1-1.html

[2] www.ruanyifeng.com/blog/2017/10/open-source-license-tutorial.html

[3] https://softwareengineering.stackexchange.com/questions/19649/copyright-notices-disclaimers-in-source-files

[4] https://softwareengineering.stackexchange.com/questions/125836/do-you-have-to-include-a-license-notice-with-every-source-file



发表评论

0 评论