从私服下载 jar包
需求 : 本例子測試從私服下載 ssm_dao 工程 jar 包。
步驟1: 在 setting.xml 中配置倉庫
在客戶端的 setting.xml 中配置私服的倉庫,由于 setting.xml 中沒有 repositories 的配置
標簽需要使用 profile 定義倉庫。
profile 的 id
< id>dev< /id>
< repositories>
< repository>
倉庫 id,repositories 可以配置多個倉庫,保證 id 不重復
< id>nexus< /id>
倉庫地址,即 nexus 倉庫組的地址
< url>http://localhost:8081/nexus/content/groups/public/< /url>
是否下載 releases 構件
< releases>
< enabled>true< /enabled>
< /releases>
是否下載 snapshots 構件
< snapshots>
< enabled>true< /enabled>
< /snapshots>
< /repository>
< /repositories>
< pluginRepositories>
插件倉庫,maven 的運行依賴插件,也需要從私服下載插件
< pluginRepository>
插件倉庫的 id 不允許重復,如果重復后邊配置會覆蓋前邊
< id>public< /id>
< name>Public Repositories< /name>
< url>http://localhost:8081/nexus/content/groups/public/< /url>
< /pluginRepository>
< /pluginRepositories>
< /profile>
步驟二: 在 setting.xml 中,使用 profile 定義倉庫需要激活才可生效。
< activeProfiles>
< activeProfile>dev< /activeProfile>
< /activeProfiles>
沒有配置 nexus 之前,如果本地倉庫沒有,去中央倉庫下載,通常在企業中會在局域網
內部署一臺私服服務器,有了私服本地項目首先去本地倉庫找 jar,如果沒有找到則連接私服從私服下載 jar 包,如果私服沒有 jar 包私服同時作為代理服務器從中央倉庫下載 jar 包,這樣做的好處是一方面由私服對公司項目的依賴 jar 包統一管理,一方面提高下載速度,項目連接私服下載 jar 包的速度要比項目連接中央倉庫的速度快的多。
總結
以上是生活随笔為你收集整理的从私服下载 jar包的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 众昂矿业架构师刘金海:萤石的工业用途解读
- 下一篇: 酷狗官网