日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

maven私服配置

發(fā)布時(shí)間:2025/3/15 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 maven私服配置 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

環(huán)境:??eclipse 、maven、nexus。

1、配置setting.xml文件

  1.1、配置本地倉(cāng)庫(kù)位置:文件中,存在節(jié)點(diǎn) “l(fā)ocalRepository”,默認(rèn)是注釋,也就是本地倉(cāng)庫(kù)使用默認(rèn)地址“Default: ~/.m2/repository”,一般為系統(tǒng)C盤(pán)"C:\Users\Administrator\m2",修改本地倉(cāng)庫(kù)位置,<localRepository>你想設(shè)置的任意目錄</localRepository>

  1.2、配置遠(yuǎn)程服務(wù)器連接認(rèn)證信息,即節(jié)點(diǎn) “server”,一般配置: 

<server><!-- 此處id設(shè)置,與pom中distributionManagement中repository元素的id相匹配 --><id>releases</id>
    <!--認(rèn)證用戶名 --><username>admin</username>
    <!--認(rèn)證密碼--><password>admin123</password></server><server><id>snapshots</id><username>admin</username><password>admin123</password></server>

  1.3、profile環(huán)境配置,此配置可以配置多種信息,如repositories、pluginRepositories、properties等,并可以選擇激活的配置信息。

<profile><id>jdk-1.7</id><activation><activeByDefault>true</activeByDefault><jdk>1.7</jdk></activation> <properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
  </properties>
</profile>

<profile>
  <id>repo</id>
  <activation>
    <activeByDefault>false</activeByDefault>
    <jdk>1.7</jdk>
  </activation>
  <repositories>
    <!--私有庫(kù)配置-->
    <repository>
      <!--私有庫(kù)id -->
      <id>nexus</id>
      <!--私有庫(kù)地址-->
      <url>http://ip:port/nexus/content/groups/public /</url>
      <!--私有庫(kù)是否支持releases版本-->
      <releases>
        <enabled>true</enabled>
      </releases>
      <!--私有庫(kù)是否支持snapshots版本-->
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>
  <pluginRepositories>
    <!--插件庫(kù)配置,具體含義私有庫(kù)配置-->
    <pluginRepository>
      <id>nexus</id>
      <url>http://ip:port/nexus/content/groups/public /</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
</profile>

  <!--激活profile -->
  <activeProfiles>
    <!--根據(jù)profile的id標(biāo)簽值激活指定的內(nèi)容-->
    <activeProfile>repo</activeProfile>
  </activeProfiles>

  1.4、項(xiàng)目中pom文件配置 

  <distributionManagement><repository><id>releases</id><name>Internal Releases</name><url>http://ip:port/nexus/content/repositories/releases</url></repository><snapshotRepository><id>snapshots</id><name>Internal Snapshots</name><url>http://ip:port/nexus/content/repositories/snapshots</url></snapshotRepository></distributionManagement>

至此,基本配置完成,在后續(xù)的項(xiàng)目deploy過(guò)程中,如果項(xiàng)目pom中,version標(biāo)識(shí)類(lèi)似 “0.0.1-SNAPSHOT”則會(huì)部署到私服的snapshots快照版本庫(kù),而不帶“SNAPSHOT”標(biāo)識(shí)的,則會(huì)發(fā)布到releases正式庫(kù)中。

  問(wèn)題:nexus同版本多次deploy到私服的話,默認(rèn)是 “Disable Redeploy”-不允許重復(fù),此時(shí)需要修改為 “Allow Redeploy”,如圖

  

?

ps:maven插件配置(未完待續(xù)。。。) 

?

轉(zhuǎn)載于:https://www.cnblogs.com/eric-fang/p/8891336.html

總結(jié)

以上是生活随笔為你收集整理的maven私服配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。