nexus下载及上传jar包
生活随笔
收集整理的這篇文章主要介紹了
nexus下载及上传jar包
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
先在linux搭建nexus
linux搭建nexus
在maven的settings.xml中配置私服地址
打開maven的settings.xml文件
1 在 servers 標簽 中添加 配置私服用戶名密碼
<!-- Another sample, using keys to authenticate.<server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional; leave empty if not used.</passphrase></server>--><!--配置私服用戶名密碼--><server><id>releases</id><username>admin</username> <password>admin123</password></server><server><id>snapshots</id><username>admin</username><password>admin123</password></server><!--配置私服用戶名密碼結束--></servers>2 在 profiles 標簽 中添加 配置私服下載jar包的模板
<properties><tomcatPath>/path/to/tomcat/instance</tomcatPath></properties></profile>--><!--配置私服下載jar包的模板 開始--><profile><id>dev</id><repositories><repository><id>nexus</id><!--倉庫地址,即nexus倉庫組的地址http://localhost:8081/nexus/content/groups/public/--><url>http://ip:8081/repository/maven-public/</url><!--是否下載releases構件--><releases><enabled>true</enabled></releases><!--是否下載snapshots構件--><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><!-- 插件倉庫,maven的運行依賴插件,也需要從私服下載插件http://localhost:8081/nexus/content/groups/public/ --><pluginRepository><id>public</id><name>Public Repositories</name><url>http:/ip:8081/repository/maven-public/</url></pluginRepository></pluginRepositories></profile><!--配置私服下載jar包的模板 結束--></profiles>3 在 settings 末尾添加 激活模板
<!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>--><!--激活模板 開始--><activeProfiles><activeProfile>dev</activeProfile></activeProfiles><!--激活模板 結束--></settings>使用nexus私服下載jar包
即pom.xml中導入jar包坐標,若本地倉庫沒有,會通過nexus下載;若nexus沒有,nexus會向中央倉庫下載,nexus配置的倉庫中會存放下載的jar包。
本地倉庫沒有,nexus下載的jar包
將jar包上傳nexus私服
將第三方jar安裝到本地倉庫
①下載Oracle的jar包(略)
②在cmd中使用mvn install命令進行安裝
mvn install:install-file -Dfile=ojdbc14-10.2.0.4.0.jar -DgroupId=com.oracle -DartifactId=ojdbc14 – Dversion=10.2.0.4.0 -Dpackaging=jar將第三方jar安裝到maven私服
①下載Oracle的jar包(略)
②在cmd中執行mvn deploy命令進行安裝
? mvn deploy:deploy-file -Dfile=ojdbc14-10.2.0.4.0.jar -DgroupId=com.oracle -DartifactId=ojdbc14 –? Dversion=10.2.0.4.0 -Dpackaging=jar –? Durl=http://ip:8081/repository/nuget-hosted/ -DrepositoryId=thirdpartyhttp://ip:8081/repository/nuget-hosted/ -->即上傳jar的倉庫地址
將項目發布到maven私服
1 配置maven的settings.xml文件
<server><id>releases</id><username>admin</username> <password>admin123</password> </server> <server><id>snapshots</id><username>admin</username><password>admin123</password> </server>2 配置項目的pom.xml文件
<distributionManagement> <repository><id>releases</id><url>http://ip:8081/repository/maven-releases/</url> </repository> <snapshotRepository><id>snapshots</id> <url>http://ip:8081/repository/maven-snapshots/</url> </snapshotRepository> </distributionManagement>3 執行mvn deploy命令
總結
以上是生活随笔為你收集整理的nexus下载及上传jar包的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 首页显示登陆用户名php,首页登录后怎么
- 下一篇: 帆软报表(finereport)点击事件