自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

82天突破1000star,項目團隊梳理出軟件開源必須注意的8個方面

開發(fā) 開發(fā)工具
近期,我們在GitHub上開源了微服務(wù)任務(wù)調(diào)度框架SIA-TASK,82天,收獲了1000+個star!由于這是SIA團隊第一次開源項目,開源的相關(guān)工作,團隊之前并沒有太多的經(jīng)驗,因此我們特別整理了本次開源的各種記錄事項,希望給今后開源的項目做參考。

近期,我們在GitHub上開源了微服務(wù)任務(wù)調(diào)度框架SIA-TASK,82天,收獲了1000+個star!由于這是SIA團隊第一次開源項目,開源的相關(guān)工作,團隊之前并沒有太多的經(jīng)驗,因此我們特別整理了本次開源的各種記錄事項,希望給今后開源的項目做參考。 

一、開發(fā)

在開源項目的開發(fā)過程中要注意以下幾點:

  • 首先,要給自己的項目取一個合適的名字,取名規(guī)則這里不再贅述,需要強調(diào)的一點是:項目名稱不能與GitHub上已開源過的項目名稱相同。
  • 其次,選擇合適的編程語言。
  • 再次,編碼過程中要注意代碼的規(guī)范。

最后要說的就是開源協(xié)議的選擇了,目前最流行的開源協(xié)議有以下六種:GPL、BSD、MIT、Mozilla、Apache和LGPL。

不同的開源協(xié)議之間的差別還是挺大的,具體如何選擇,可以參考一張圖看懂開源協(xié)議(https://blog.csdn.net/cwt19902010/article/details/53736746),如果這些常用的開源協(xié)議都不適合你的項目,你也可以自己寫一個自己的開源協(xié)議。

為了更方便查看開源協(xié)議選擇圖,參考圖如下:

82天突破1000star,项目团队梳理出软件开源必须注意的8个方面

以Apache License Version 2.0協(xié)議為例,比較常用協(xié)議與Apache協(xié)議沖突情況,沖突圖如下:

82天突破1000star,项目团队梳理出软件开源必须注意的8个方面

二、協(xié)議

項目開發(fā)完成之后,需要梳理出項目中使用到的協(xié)議(包含項目引用的組件中用到的協(xié)議),此處推薦使用maven許可證插件。插件配置參見License Maven Plugin(https://www.mojohaus.org/license-maven-plugin/)maven許可證插件在主pom中配置示例如下(此處開源協(xié)議采用Apache 2.0)

  1. <!--開源協(xié)議采用Apache 2.0協(xié)議-->  
  2.     <licenses>  
  3.         <license>  
  4.             <name>Apache License, Version 2.0</name>  
  5.             <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>  
  6.             <distribution>repo</distribution>  
  7.         </license>  
  8.     </licenses>  
  9.   
  10.     <plugins>  
  11.          <plugin>  
  12.              <groupId>org.codehaus.mojo</groupId>  
  13.              <artifactId>license-maven-plugin</artifactId>  
  14.              <version>1.13</version>  
  15.              <configuration>  
  16.                  <!-- config for license:aggregate-add-third-party -->  
  17.                  <outputDirectory>${main.basedir}</outputDirectory>  
  18.                  <thirdPartyFilename>LICENSE-3RD-PARTY</thirdPartyFilename>  
  19.                  <fileTemplate>/org/codehaus/mojo/license/third-party-file-groupByLicense.ftl</fileTemplate>  
  20.                  <useMissingFile>true</useMissingFile>  
  21.                  <missingFile>${main.basedir}/LICENSE-3RD-PARTY.properties</missingFile>  
  22.                  <aggregateMissingLicensesFile>${main.basedir}/LICENSE-3RD-PARTY.properties</aggregateMissingLicensesFile>  
  23.                  <licenseMerges>  
  24.                      <licenseMerge>Apache 2.0|ASL, version 2|http://www.apache.org/licenses/LICENSE-2.0.txt|http://asm.ow2.org/license.html|The Apache License, Version 2.0|Apache License|Apache License Version 2|Apache License Version 2.0|Apache Software License - Version 2.0|Apache 2.0 License|Apache License 2.0|ASL|Apache 2|Apache-2.0|the Apache License, ASL Version 2.0|The Apache Software License, Version 2.0|Apache License, Version 2.0|Apache Public License 2.0</licenseMerge>  
  25.                      <licenseMerge>BSD|The BSD 3-Clause License|The BSD License|Modified BSD License|New BSD License|New BSD license|Two-clause BSD-style license|BSD licence|BSD New|The New BSD License|BSD 3-Clause|BSD 3-clause</licenseMerge>  
  26.                      <licenseMerge>MIT|MIT License|The MIT License</licenseMerge>  
  27.                      <licenseMerge>LGPL|LGPL, version 2.1|GNU Library or Lesser General Public License (LGPL) V2.1|GNU Lesser General Public License (LGPL), Version 2.1|GNU Lesser General Public License, Version 2.1|LGPL 2.1</licenseMerge>  
  28.                      <licenseMerge>CDDL|CDDL+GPL|CDDL+GPL License|CDDL + GPLv2 with classpath exception|CDDL License|CDDL 1.0|CDDL 1.1|COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0|Common Development and Distribution License (CDDL) v1.0</licenseMerge>  
  29.                      <licenseMerge>EPL|Eclipse Public License - Version 1.0</licenseMerge>  
  30.                      <licenseMerge>GPL|GPL2 w/ CPE|GPLv2+CE|GNU General Public Library</licenseMerge>  
  31.                      <licenseMerge>MPL|MPL 1.1</licenseMerge>  
  32.                      <licenseMerge>Public Domain</licenseMerge>  
  33.                      <licenseMerge>Common Public License|Common Public License Version 1.0</licenseMerge>  
  34.                      <licenseMerge>CC0|CC0 1.0 Universal|Public Domain, per Creative Commons CC0</licenseMerge>  
  35.                      <licenseMerge>Unknown License|Unknown license</licenseMerge>  
  36.                  </licenseMerges>  
  37.   
  38.                  <!-- config for license:aggregate-download-licenses -->  
  39.                  <aggregateDownloadLicenses.executeOnlyOnRootModule>true</aggregateDownloadLicenses.executeOnlyOnRootModule>  
  40.                  <!--<licensesConfigFile>${main.basedir}/lic/config/licenses.xml</licensesConfigFile>-->  
  41.                  <licensesOutputFile>${main.basedir}/lic/licenses.xml</licensesOutputFile>  
  42.                  <licensesOutputDirectory>${main.basedir}/lic/licenses/</licensesOutputDirectory>  
  43.   
  44.                  <!-- config for license:update-file-header -->  
  45.                  <licenseName>apache_v2</licenseName>  
  46.                  <inceptionYear>2019</inceptionYear>  
  47.                  <organizationName>sia</organizationName>  
  48.                  <projectName>task</projectName>  
  49.                  <roots>  
  50.                      <root>src/main/java</root>  
  51.                      <root>src/test/java</root>  
  52.                  </roots>  
  53.                  <includes>  
  54.                      <include>**/*.java</include>  
  55.                      <include>**/*.xml</include>  
  56.                      <include>**/*.sh</include>  
  57.                      <include>**/*.py</include>  
  58.                      <include>**/*.properties</include>  
  59.                      <include>**/*.sql</include>  
  60.                      <include>**/*.html</include>  
  61.                      <include>**/*.less</include>  
  62.                      <include>**/*.css</include>  
  63.                      <include>**/*.js</include>  
  64.                      <include>**/*.json</include>  
  65.                  </includes>  
  66.                  <canUpdateCopyright>true</canUpdateCopyright>  
  67.                  <canUpdateDescription>true</canUpdateDescription>  
  68.                  <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>  
  69.                  <emptyLineAfterHeader>true</emptyLineAfterHeader>  
  70.                  <processStartTag>&lt;&lt;</processStartTag>  
  71.                  <processEndTag>&gt;&gt;</processEndTag>  
  72.                  <sectionDelimiter>==</sectionDelimiter>  
  73.   
  74.                  <!-- config for mvn license:update-project-license -->  
  75.                  <licenseFile>${main.basedir}/LICENSE</licenseFile>  
  76.              </configuration>  
  77.          </plugin>  
  78.          <plugin>  
  79.              <groupId>org.jasig.maven</groupId>  
  80.              <artifactId>maven-notice-plugin</artifactId>  
  81.              <version>1.0.6.1</version>  
  82.              <configuration>  
  83.                  <generateChildNotices>false</generateChildNotices>  
  84.                  <noticeTemplate>https://source.jasig.org/licenses/NOTICE.template</noticeTemplate>  
  85.                  <licenseMapping>  
  86.                      <param>https://source.jasig.org/licenses/license-mappings.xml</param>  
  87.                  </licenseMapping>  
  88.              </configuration>  
  89.          </plugin>  
  90.      </plugins>  

配置完成之后,執(zhí)行如下命令即可生成相應(yīng)的協(xié)議到對應(yīng)的文件,命令如下

  1. #### Updates (or creates) the main project license file according to the license defined in the licenseName parameter. 
  2. `mvn license:update-project-license` 
  3.  
  4. #### Generates a file containing a list of all dependencies and their licenses for a multi-module build. 
  5. `mvn license:aggregate-add-third-party` 
  6.  
  7. #### Downloads the license files associated with each dependency for a multi-modules build. 
  8. `mvn license:aggregate-download-licenses` 
  9.  
  10. #### Generate NOTICE? 
  11. `mvn notice:generate` 

項目開源時,需要在源文件的頂部添加一個保護許可,修改、檢查、刪除源文件頭部保護許可命令如下:

  1. #### how to generate/update source code header? 
  2. ## Updates the license header of the current project source files. 
  3. mvn license:update-file-header 
  4. ## Checks the license header of the current project source files. 
  5. mvn license:check-file-header 
  6. ## Remove any license header of the current project source files. 
  7. mvn license:remove-file-header 

執(zhí)行完上述命令之后,會生成幾個協(xié)議文件,其中有兩個關(guān)鍵的文件:

  1. LICENSE文件:存放當(dāng)前開源項目中用到的開源協(xié)議信息。</br> 
  2. LICENSE-3RD-PARTY文件:組件使用到的協(xié)議。</br> 

在LICENSE-3RD-PARTY文件中查看組件使用的協(xié)議,參考前面介紹的各協(xié)議沖突情況,查看看組件中用到的協(xié)議是否與當(dāng)前開源項目選擇的開源協(xié)議有沖突,如果有沖突,需要替換掉協(xié)議沖突的接口。 

三、安全掃描 

 

 

安全掃描是項目開源流程中必不可少的一步,安全掃描關(guān)注的點主要有以下幾個:

 

  • 組件層面安全問題。比如:組件是否存在遠程代碼執(zhí)行風(fēng)險、XXE風(fēng)險等。 
  • 代碼層面安全問題。比如:RequestMapping上請求未限制方法等。 
  • 公司敏感信息是否外泄。比如:數(shù)據(jù)庫連接信息、郵箱信息等被暴露。

備注:安全掃描工作由安全部·安全服務(wù)團隊的同事負責(zé)完成,項目開發(fā)完成之后,可聯(lián)系安全服務(wù)團隊的同事進行代碼安全掃描工作。
四、文檔 

 

README文檔相當(dāng)于開源項目的一個門面,如果README文檔寫得好,能夠讓用戶更了解開源項目的功能,減少用戶的使用成本??梢哉fREADME文檔寫得好的開源項目不一定是好的開源項目,但是好的開源項目的README文檔寫得一定好。
下面簡單介紹下README文檔的編寫規(guī)范。綜合GitHub上很多大型開源項目的README文檔,個人認(rèn)為READEME文檔主要由以下幾部分組成:
1)項目介紹
項目介紹是為了讓別人快速了解項目。主要內(nèi)容包括項目背景、項目簡介。
2)項目架構(gòu)
項目架構(gòu)主要介紹項目的實現(xiàn)方式,可以讓用戶更了解項目的實現(xiàn)原理。 
3)項目集成方式 
項目集成方式即項目開發(fā)指南,可以列出項目的部署方式,或者是jar包的使用方式。
4)項目使用指南
項目使用指南也就是告訴用戶怎么使用項目。最好是附上每一步的使用截圖信息,這樣能減少后期跟用戶之間的溝通成本。
5)版本說明
此處需要告訴用戶使用哪個版本更穩(wěn)定。
6)版權(quán)說明
版權(quán)信息可以用于作者的維權(quán),保護作者版本信息的合法權(quán)益。
7)項目交流方式
項目交流方式部分可以留下開源作者或者是組織的微信、微博、郵箱等聯(lián)系方式,方便用戶與開源作者進一步技術(shù)溝通。
五、版本 

 

 

GitHub上開源的項目需要有個版本號,版本格式為:主版本號.次版本號.修訂號,版本號遞增規(guī)則如下:

 

  • 主版本號:當(dāng)你做了不兼容的 API 修改; 
  • 次版本號:當(dāng)你做了向下兼容的功能性新增;
  • 修訂號:當(dāng)你做了向下兼容的問題修正。

 先行版本號及版本編譯元數(shù)據(jù)可以加到“主版本號.次版本號.修訂號”的后面,作為延伸。

 

更形象的解釋如下:標(biāo)準(zhǔn)的版本號必須采用 X.Y.Z 的格式,其中 X、Y 和 Z 為非負的整數(shù),且禁止在數(shù)字前方補零。X 是主版本號、Y 是次版本號、而 Z 為修訂號。每個元素必須以數(shù)值來遞增。例如:1.9.1 -> 1.10.0 -> 1.11.0。
備注:開源版本規(guī)范引自GitHub命名規(guī)范:語義化版本2.0.0https://semver.org/lang/zh-CN/

 

六、開源

做完上述幾步的工作之后,我們就可以把項目上傳到GitHub上進行開源了。GitHub的使用網(wǎng)上有很多文章介紹,這里不再贅述,可以參考 在GitHub上參與開源項目日常流程https://blog.csdn.net/five3/article/details/9307041

七、后期

開源后期維護服務(wù)是開源項目時最容易被忽視的,為了讓用戶更好地使用開源項目,我們可以通過GitHub issue、微信答疑群、論壇、社區(qū)文章分享等互動形式做好開源后期服務(wù)工作。

八、迭代

GitHub上迭代開發(fā)流程如下:項目owner給項目開發(fā)者設(shè)置member權(quán)限,member用戶fork開源項目的資源成自己的資源,然后修改fork之后的資源,修改完成之后,提merge請求,只有項目owner才有權(quán)限merge。如何同步fork項目可參見如下文章如何同步fork項目https://blog.csdn.net/t111t/article/details/45894381 

 

 

開源項目:
微服務(wù)任務(wù)調(diào)度框架 :https://github.com/siaorg/sia-task

 

 

 

微服務(wù)路由網(wǎng)關(guān) :https://github.com/siaorg/sia-gateway

 

 

 

【本文是51CTO專欄機構(gòu)宜信技術(shù)學(xué)院的原創(chuàng)文章,微信公眾號“宜信技術(shù)學(xué)院( id: CE_TECH)”】

 

 

 

 

 

 

 

 

 

 

責(zé)任編輯:張燕妮 來源: 宜信技術(shù)學(xué)院
相關(guān)推薦

2019-07-24 08:56:56

2014-01-26 14:24:25

開源項目

2020-11-05 14:12:16

Vue開源項目js框架

2010-09-26 15:37:34

制定數(shù)據(jù)加密項目

2010-01-08 16:46:59

office2010下載

2021-01-09 16:16:40

開源軟件速查表編程語言

2024-02-02 08:42:06

開源項目Expensify前端

2010-09-01 09:39:07

CSS

2016-09-26 10:05:03

物聯(lián)網(wǎng)物聯(lián)網(wǎng)開源項目

2023-06-28 13:48:23

開源圖片

2014-03-18 09:04:25

2019-02-28 10:18:44

GitHub 技術(shù)開源

2014-03-18 11:08:07

2018-09-14 14:00:51

開源項目管理工具

2023-07-10 15:51:03

項目經(jīng)理軟件性能

2024-04-02 08:05:27

商業(yè)智能報告

2009-06-04 10:20:34

Hibernate持久化Java

2010-06-21 15:36:21

互聯(lián)網(wǎng)協(xié)議

2017-03-08 15:37:23

商用電腦初創(chuàng)企業(yè)

2009-02-01 15:16:28

點贊
收藏

51CTO技術(shù)棧公眾號