<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # nexus搭建maven私服及私服jar包上傳和下載 一、nexus搭建maven私服及相關介紹 1、下載nexus-2.12.0-01-bundle.zip(版本隨意) 2、cmd進入bin目錄,執行nexus 下一步執行nexus install 3、開啟nexus服務,訪問nexus服務器地址:http://localhost:8081/nexus/,默認登錄賬戶為admin,默認密碼為admin123,登錄成功后點擊Repositories可看到私服有以下類型倉庫: ![](https://img-blog.csdn.net/20170628124733808?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbm9jb2wxMjM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center) 1)hosted,宿主倉庫,部署自己的jar到這個類型的倉庫,包括releases和snapshot兩部分,Releases公司內部發布版本倉庫、 Snapshots 公司內部測試版本倉庫 2)proxy,代理倉庫,用于代理遠程的公共倉庫,如maven中央倉庫,用戶連接私服,私服自動去中央倉庫下載jar包或者插件。 3)group,倉庫組,用來合并多個hosted/proxy倉庫,通常我們配置自己的maven連接倉庫組。 4)virtual(虛擬):兼容Maven1 版本的jar或者插件 4、nexus倉庫默認在解壓文件的sonatype-work\\nexus\\storage目錄中: ![](https://img-blog.csdn.net/20170628124825477?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbm9jb2wxMjM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center) apache-snapshots:代理倉庫,存儲snapshots構件,代理地址https://repository.apache.org/snapshots/ central-m1:virtual類型倉庫,兼容Maven1 版本的jar或者插件 releases:本地倉庫,存儲releases構件。 snapshots:本地倉庫,存儲snapshots構件。 thirdparty:第三方倉庫 public:倉庫組 二、向maven私服上傳寫好的jar 1、需求:將項目子模塊ssm\_dao這個工程打包成jar并上傳到私服 2、第一步:需要在客戶端即部署dao工程的電腦上配置 maven環境,并修改 settings.xml 文件,配置連接私服的用戶 和密碼。此用戶名和密碼用于私服校驗,因為私服需要知道上傳都 的賬號和密碼 是否和私服中的賬號和密碼 一致。 在maven文件夾下apache-maven-3.5.0\\conf\\settings.xml文件添加一下代碼:(節點內) ~~~html <server> <!--releases 連接發布版本項目倉庫--> <id>releases</id> <!--訪問releases這個私服上的倉庫所用的賬戶和密碼--> <username>admin</username> <password>admin123</password> </server> <server> <!--snapshots 連接測試版本項目倉庫--> <id>snapshots</id> <!--訪問releases這個私服上的倉庫所用的賬戶和密碼--> <username>admin</username> <password>admin123</password> </server> ~~~ 3、在ssm\_dao的pom.xml文件中添加一下代碼: ~~~html <!--將ssm_dao上傳私服 --> <distributionManagement> <!--pom.xml這里<id> 和 settings.xml 配置 <id> 對應 --> <repository> <id>releases</id> <url>http://localhost:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <url>http://localhost:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> ~~~ 根據工程的版本號決定上傳到哪個宿主倉庫,如果版本為release則上傳到私服的release倉庫,如果版本為snapshot則上傳到私服的snapshot倉庫。 如:ssm\_dao的工程的版本號為0.0.1-SNAPSHOT,則ssm\_dao打包好的jar在本地倉庫snapshots可見 ~~~html <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.nocol</groupId> <artifactId>ssm_parent</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>ssm_dao</artifactId> ~~~ 4、正式上傳:首先啟動nexus服務,對ssm\_dao工程執行deploy命令,看到BUILD SUCCESS則表示上傳成功了 ![](https://img-blog.csdn.net/20170628125247108?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbm9jb2wxMjM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center) 此時在\\nexus-2.12.0-01-bundle\\sonatype-work\\nexus\\storage\\snapshots下能找到,但是在本地倉庫并沒有,因為jar包上傳在maven私服,接下來介紹如何能讓自己上傳的jar出現在本地倉庫 如圖:(本地snapshots) ![](https://img-blog.csdn.net/20170628125325868?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbm9jb2wxMjM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center) 如圖:(私服) ![](https://img-blog.csdn.net/20170628125352045?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbm9jb2wxMjM=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center) 5、此時將ssm\_dao工程關閉,可以看到依賴ssm\_dao的ssm\_service工程出現感嘆號(缺少了ssm\_dao.jar) 三、maven私服自動下載jar包 1、在沒有配置nexus之前,如果本地倉庫沒有,去中央倉庫下載。有了私服之后,本地項目首先去本地倉庫找jar,如果沒有找到則連接私服從私服下載jar包,如果私服沒有jar包私服同時作為代理服務器從中央倉庫下載jar包,這樣提高了下載速度,項目連接私服下載jar包的速度要比項目連接中央倉庫的速度快的多。 2、nexus中包括很多倉庫,如上面介紹的hosted中存放的是自己發布的jar包及第三方公司的jar包,proxy中存放的是中央倉庫的jar,為了方便從私服下載jar包可以將多個倉庫組成一個倉庫組,每個工程需要連接私服的倉庫組下載jar包,這樣在項目中配置下載路徑只需要給倉庫組路徑即可,即: http://localhost:8081/nexus/content/groups/public/ 3、第一步:在客戶端的setting.xml中配置私服的倉庫,由于setting.xml中沒有repositories的配置標簽需要使用profile定義倉庫(profile節點內),然后把阿里鏡像禁止掉 ~~~html <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> ~~~ 使用profile定義倉庫需要激活才可生效,再在profile結束標簽后添加一下代碼: ~~~html <!--使用profile定義倉庫需要激活才可生效--> <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles> ~~~ 4、配置成功后通過eclipse查看ssm\_service工程下pom.xml的Effective POM選項,可看到如下代碼: ~~~html <repositories> <repository> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> <id>nexus</id> <url>http://localhost:8081/nexus/content/groups/public/</url> </repository> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>Central Repository</name> <url>https://repo.maven.apache.org/maven2</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>public</id> <name>Public Repositories</name> <url>http://localhost:8081/nexus/content/groups/public/</url> </pluginRepository> <pluginRepository> <releases> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>Central Repository</name> <url>https://repo.maven.apache.org/maven2</url> </pluginRepository> </pluginRepositories> ~~~ 表示當該工程需要的jar在本地倉庫沒有時,根據這里配置的訪問路徑自動去maven私服下載。此時再update一下父工程,發現ssm\_service的感嘆號消失(此時ssm\_dao還是close狀態),說明ssm\_service工程已經在maven私服內下載了ssm\_dao.jar,同時在本地倉庫也存在了該jar。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看