<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    ALL is Well!

    敏捷是一條很長的路,摸索著前進著

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      30 隨筆 :: 23 文章 :: 71 評論 :: 0 Trackbacks

    搭建repository私服的用處有很多。
    除了如何如何管理好jar包外,還有就是當 maven2 無法自動獲取某個jar包時,(例如 oracle的jdbc jar包)
    我們需要手動下載此jar包,將其上傳至我們得私服,填寫groupId,artifactId,version等信息。
    然后再在pom.xml里進行依賴配置。

    我搭建私服的工具是artifactory-2.2.3。
    首先到網上下載artifactory-2.2.3,google一下,什么都有了。
    下載好后,將其解壓到任意目錄。
    由于artifactory自帶了Jetty Web服務器,所以,只要雙擊\bin\artifactory.bat 即可運行。(太方便了)
    待服務器啟動好后,用 http://localhost:8081/artifactory/ 開發頁面。
    默認的用戶名密碼是:admin/password.
    畫面如下:


    輸入用戶名:admin 密碼:password 登錄。

    進入畫面后,點擊Deploy,選擇要上傳的jar包。


    選中jar包后,點擊 Upload,會彈出 如下圖畫面:


    這里的GroupId、ArtifactId、Version便是要在pom.xml里添加依賴時指定的元素。
    同時,可以點擊POM Editor 來對它的 pom.xml進行編輯。如下代碼:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi
    ="http://www.w3.org/2001/XMLSchema-instance">
      
    <modelVersion>4.0.0</modelVersion>
      
    <groupId>poi</groupId>
      
    <artifactId>poi</artifactId>
      
    <version>3.6</version>
      
    <description>Artifactory auto generated POM</description>
    </project>


    這還不算完??!這只是建立了repository私服,但是怎樣告訴maven在compile、package時去本地私服尋找依賴包呢?

    有兩種方式來配置,一是在settings.xml里指定,二是在項目的pom.xml中指定。

    我是在settings.xml中進行指定,在settings.xml文件中,加入Profile節點。
    (關于此節點的說明,請參見:http://m.tkk7.com/jnbzwm/archive/2010/09/03/330862.html


    <profiles>
        
    <profile>
          
    <id>localrepo</id>
          
    <activation>
            
    <jdk>1.6</jdk>
          
    </activation>
          
    <repositories>
            
    <repository>
              
    <id>central</id>
              
    <name>artifactory at local</name>
              
    <url>http://localhost:8081/artifactory/repo</url>
              
    <layout>default</layout>
              
    <snapshots>   
                
    <enabled>false</enabled>   
             
    </snapshots>
            
    </repository>
            
    <repository>   
             
    <id>snapshots</id>   
              
    <url>http://localhost:8081/artifactory/repo</url>   
               
    <releases>   
                
    <enabled>false</enabled>   
               
    </releases>   
            
    </repository>
          
    </repositories>
          
    <pluginRepositories>
            
    <pluginRepository>
                
    <id>artifactory</id>
                
    <name>artifactory plugins at local </name>
                
    <url>http://localhost:8081/artifactory/plugins-releases</url>
                
    <snapshots>
                    
    <enabled>false</enabled>
                
    </snapshots>
            
    </pluginRepository>
        
    </pluginRepositories>
    </profiles>

    在前一個學習筆記中有提到,配置profile后,需要進行激活,所以再在settings.xml中,加入activeProfiles節點的配置。

      <activeProfiles>
        
    <activeProfile>localrepo</activeProfile>
      
    </activeProfiles>

    這里指定的localrepo 就是我們配置的profile的Id。

    到此,配置結束。


    本文為原創,歡迎轉載,轉載請注明出處BlogJava。
    posted on 2010-09-03 14:15 李 明 閱讀(895) 評論(0)  編輯  收藏 所屬分類: Maven2
    主站蜘蛛池模板: 亚洲综合激情另类专区| 福利免费观看午夜体检区| 亚洲国产香蕉人人爽成AV片久久 | 精品国产污污免费网站| 亚洲中文字幕视频国产| 久草免费福利在线| 在线亚洲人成电影网站色www| 国产一级一毛免费黄片| 亚洲综合另类小说色区| 日本视频免费高清一本18| 亚洲2022国产成人精品无码区| 无码日韩精品一区二区三区免费| 国产亚洲高清不卡在线观看| 免费黄网站在线观看| 久久久国产精品亚洲一区| 四虎成年永久免费网站| 亚洲三级在线视频| 国产成人精品123区免费视频| 国产亚洲视频在线观看| 亚洲精品国产V片在线观看| 男人天堂免费视频| 日韩亚洲Av人人夜夜澡人人爽| 无码区日韩特区永久免费系列 | 亚洲免费观看网站| 国产成人精品亚洲2020| 国产成人免费a在线资源| 中国内地毛片免费高清| 亚洲成人午夜电影| mm1313亚洲国产精品美女| 国产中文字幕在线免费观看| 亚洲综合精品一二三区在线| 浮力影院第一页小视频国产在线观看免费| 狠狠入ady亚洲精品| 亚洲AV无码乱码在线观看裸奔| 无码日韩人妻av一区免费| 免费无码午夜福利片69| 亚洲国产成人久久综合一| 热99re久久免费视精品频软件| 成人网站免费大全日韩国产| 亚洲视频一区在线观看| 免费观看午夜在线欧差毛片|