Har 版本包發佈

新建 Module

注意名字最好是小寫命名

oh-package.json5 修改 description 描述信息

在 Index.ets 導出對外暴露的組件

export{ TitleBar } from'./src/main/ets/view/TitleBar'
 

編譯生成 har 包

 
生成公鑰和私鑰
  1. 新建文件夾,新建空的 pub 文件。
  1. 命令生成公鑰和私鑰。
      publish_id 在個人中心複製(https://ohpm.openharmony.cn/#/cn/personalCenter/notifications)。
     
     ssh-keygen -m PEM -t RSA -b 4096 -f pub文件絕對路徑 
     
     // 輸⼊量兩次⼀致的密碼,即可⾃動⽣成密鑰 
     Enter passphrase (empty for no passphrase): 
     Enter same passphrase again: 
     
     ohpm config set key_path pub文件絕對路徑 
     ohpm config set publish_id 複製的發佈碼
     ohpm publish har包絕對路徑 

個人中心中查看發佈的信息

本地安裝 Har 文件

第一種方式:

ohpm install har文件的絕對路徑

第二種方式:

在工程的 oh-package.json5 中設置三方包依賴:
在 oh-package.json5 配置 har 相對路徑:
執行 ohpm install 來安裝依賴包。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章