国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 操作系統 > 正文

【Maven】Nexus配置和使用

2024-06-28 16:02:37
字體:
來源:轉載
供稿:網友

Nexus安裝

  nexus安裝,可以參照:【Maven】Nexus(Maven倉庫私服)下載與安裝

Nexus簡單說明

 用途:指定私服的中央地址、將自己的Maven項目指定到私服地址、從私服下載中央庫的項目索引、從私服倉庫下載依賴組件、將第三方項目jar上傳到私服供其他項目組使用   倉庫:

      hosted   類型的倉庫,內部項目的發布倉庫 

      releases 內部的模塊中release模塊的發布倉庫

      snapshots 發布內部的SNAPSHOT模塊的倉庫  

      3rd party 第三方依賴的倉庫,這個數據通常是由內部人員自行下載之后發布上去 

      PRoxy   類型的倉庫,從遠程中央倉庫中尋找數據的倉庫

      group   類型的倉庫,組倉庫用來方便我們開發人員進行設置的倉庫

      

Nexus配置

  nexus配置大部分使用默認配置即可,主要是配置一個項目索引

  選擇Central倉庫,設置Download Remote Indexes:True

  

Nexus使用

  項目使用nexus私服的jar包,在項目的pom.xml文件中指定私服倉庫復制代碼
 1 <repositories> 2     <repository> 3         <id>nexus</id> 4         <name>nexus</name> 5         <url>http://192.168.1.103:8081/nexus/content/groups/public/</url> 6         <releases> 7             <enabled>true</enabled> 8         </releases> 9         <snapshots>10             <enabled>true</enabled>11         </snapshots>12     </repository>13 </repositories>復制代碼

 

  項目使用nexus私服的插件,在項目的pom.xml文件中指定插件倉庫復制代碼
 1 <pluginRepositories> 2     <pluginRepository> 3         <id>nexus</id> 4         <name>nexus</name> 5         <url>http://192.168.1.103:8081/nexus/content/groups/public/</url> 6         <releases> 7             <enabled>true</enabled> 8         </releases> 9         <snapshots>10             <enabled>true</enabled>11         </snapshots>12     </pluginRepository>13 </pluginRepositories>復制代碼

 

  如果想本機所有的maven項目都使用私服的組件,可以在maven的設置文件settings.xml中添加屬性,并激活復制代碼
 1 <profiles> 2     <profile> 3         <id>nexusProfile</id> 4         <repositories> 5             <repository> 6                 <id>nexus</id> 7                 <name>nexus</name> 8                 <url>http://192.168.1.103:8081/nexus/content/groups/public/</url> 9                 <releases>10                     <enabled>true</enabled>11                 </releases>12                 <snapshots>13                     <enabled>true</enabled>14                 </snapshots>15             </repository>16         </repositories>17     </profile>18 </profiles>19 <!-- 激活 -->20 <activeProfiles>21     <activeProfile>nexusProfile</activeProfile>22 </activeProfiles>復制代碼

 

 項目發布到私服,maven項目使用命令:mvn clean deploy;需要在pom文件中配置一下代碼;復制代碼
 1 <distributionManagement> 2         <repository> 3             <id>user-release</id> 4             <name>User Project Release</name> 5             <url>http://192.168.1.103:8081/nexus/content/repositories/releases/</url> 6         </repository> 7  8         <snapshotRepository> 9             <id>user-snapshots</id>10             <name>User Project SNAPSHOTS</name>11             <url>http://192.168.1.103:8081/nexus/content/repositories/snapshots/</url>12         </snapshotRepository>13     </distributionManagement>復制代碼

注意還需要配置mvn發布的權限,否則會報401錯誤,在settings.xml中配置權限,其中id要與pom文件中的id一致

復制代碼
 1 <server> 2     <id>user-release</id> 3     <username>admin</username> 4     <passWord>admin123</password> 5 </server> 6 <server> 7     <id>user-snapshots</id> 8     <username>admin</username> 9     <password>admin123</password>10 </server>復制代碼

發布成功后,可以在nexus中看到

    

  上傳第三方的jar包,選擇3rd party-->Artifact Upload--> 選擇GAV方式-->填好構建參數-->增加jar包-->上傳,在Browse Storeage查看

   

   

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 张家界市| 固阳县| 沂水县| 虎林市| 舒城县| 平原县| 杭锦旗| 株洲市| 尖扎县| 宜章县| 和林格尔县| 安溪县| 驻马店市| 高阳县| 靖西县| 宝兴县| 皋兰县| 白沙| 德格县| 汝州市| 屏南县| 旅游| 宜昌市| 根河市| 蓬溪县| 宝应县| 万山特区| 酒泉市| 柘城县| 定日县| 鄂托克旗| 宁河县| 松江区| 宁都县| 安丘市| 永和县| 黑水县| 白山市| 古交市| 宜阳县| 东源县|