1. 程式人生 > >maven 私服setting.xml配置

maven 私服setting.xml配置

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user, 
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in 
 |                 ${maven.home}/conf/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
   <localRepository>E:\\maven\\repository</localRepository>   
  <!-- 配置映象 -->
  <mirrors>  	
    <mirror>
	  <!-- 此映象一般用來作為公司內部開發的版本快照,作為public-snapshots倉庫的映象地址 -->
	  <!-- 映象的id,id用來區分不同的mirror元素。 --> 
      <id>nexus-public-snapshots</id>
	  <!-- 被映象的伺服器的id。例如,如果我們要設定了一個Maven中央倉庫(http://repo1.maven.org/maven2)的映象,
	  	就需要將該元素設定成central。這必須和中央倉庫的id “central”完全一致。 -->
      <mirrorOf>public-snapshots</mirrorOf>
	  <!-- 該映象的URL。 --> 
      <url>http://192.168.10.92:8081/nexus/content/groups/public-snapshots</url>
    </mirror>
	
    <mirror>
	  <!-- 此映象一般用來作為公司第三方引用基礎類庫映象,是所有倉庫的映象地址 -->
      <id>nexus</id>
	  <!-- 為*表示為所有的倉庫做映象,有了這個配置,所有的構建都會包含public組,如果你想包含public-snapshots組,
	  	你必須新增public-snapshots這個Profile,通過在命令列使用如下的 -P 標誌:$ mvn -P public-snapshots clean install -->
      <mirrorOf>*</mirrorOf>
      <url>http://192.168.10.92:8081/nexus/content/groups/public</url>
    </mirror>	
  </mirrors>
  
  <!-- settings.xml中的profile元素是pom.xml中profile元素的裁剪版本。它包含了activation, repositories, pluginRepositories 和 properties元素。
  	這裡的profile元素只包含這四個子元素是因為這裡只關心構建系統這個整體(這正是settings.xml檔案的角色定位),而非單獨的專案物件模型設定。  
	如果一個settings中的profile被啟用,它的值會覆蓋任何其它定義在POM中或者profile.xml中的帶有相同id的profile。 --> 
  <profiles>
    <profile>
      <id>development</id>
	  <!-- 倉庫。倉庫是Maven用來填充構建系統本地倉庫所使用的一組遠端專案。而Maven是從本地倉庫中使用其外掛和依賴。
	  	不同的遠端倉庫可能含有不同的專案,而在某個啟用的profile下,可能定義了一些倉庫來搜尋需要的釋出版或快照版構件。有了Nexus,這些應該交由Nexus完成 -->
      <repositories>
        <repository>
          <id>central</id>
		  <!-- 虛擬的URL形式,指向映象的URL,因為所有的映象都是用的是nexus,這裡的central實際上指向的是http://repos.d.xxx.com/nexus/content/groups/public -->
          <url>http://central</url>
		  <!-- 表示可以從這個倉庫下載releases版本的構件-->
          <releases><enabled>true</enabled></releases>
		  <!-- 表示可以從這個倉庫下載snapshot版本的構件 -->
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
	 
	 <!-- 外掛倉庫。倉庫是兩種主要構件的家。第一種構件被用作其它構件的依賴。這是中央倉庫中儲存大部分構件型別。
	 	另外一種構件型別是外掛。Maven外掛是一種特殊型別的構件。由於這個原因,外掛倉庫獨立於其它倉庫。
		pluginRepositories元素的結構和repositories元素的結構類似。每個pluginRepository元素指定一個Maven可以用來尋找新外掛的遠端地址。 -->  
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
	
    <profile>
      <!--this profile will allow snapshots to be searched when activated-->
      <id>public-snapshots</id>
      <repositories>
        <repository>
          <id>public-snapshots</id>
		  <!-- 虛擬的URL形式,指向映象的URL,這裡指向的是http://repos.d.xxx.com/nexus/content/groups/public-snapshots -->
          <url>http://public-snapshots</url>
          <releases><enabled>false</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>public-snapshots</id>
          <url>http://public-snapshots</url>
          <releases><enabled>false</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  
  <!-- 啟用的Profile。activation元素並不是啟用profile的唯一方式。settings.xml檔案中的activeProfile元素可以包含profile的id,
  	任何在activeProfile中定義的profile id,不論環境設定如何,其對應的profile都會被啟用。如果沒有匹配的profile,則什麼都不會發生。
	profile也可以通過在命令列,使用-P標記和逗號分隔的列表來顯式的啟用(如,-P test)。
	要了解在某個特定的構建中哪些profile會啟用,可以使用maven-help-plugin(mvn help:active-profiles)。 -->  
  <activeProfiles>
  	<!-- 沒有顯示啟用public-snapshots -->
    <activeProfile>development</activeProfile>
  </activeProfiles>

<!-- 自定義本地倉庫地址,其預設值為~/.m2/repository 
<localRepository>/data/maven-repository</localRepository>
-->
  <!-- 釋出的伺服器和密碼,暫時未限制許可權 -->
   <servers>
    <server>
      <!-- 釋出的位置在POM中配置,以ID為關聯,有很多公用的資訊需要配置在POM檔案裡,最佳實踐是定義一個公司級別的root pom -->
      <id>nexus</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
    <server>
      <id>nexus-snapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
	<server>
      <id>thirdparty</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>
</settings>

相關推薦

maven setting.xml配置

<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor lice

maven:的相關配置

group rep clas nexus倉庫 http ots set release mave 添加到settings.xml中 <server> <id>releases</id> <us

Maven 配置

pan eas white snapshot 認證 str sta XML posit 1.下載nexus   nexus https://help.sonatype.com/display/NXRM3/Download 2.配置環境變量   export PATH=$P

maven配置

http 文件中 compiler ont 設置 oca 需要 發布 密碼 環境: eclipse 、maven、nexus。 1、配置setting.xml文件   1.1、配置本地倉庫位置:文件中,存在節點 “localRepository”,默認是註釋,也就是本地倉

Maven之pom.xmlsetting.xml配置檔案詳解

一.pom.xml詳解     1.概述     pom中節點如下分佈 <project xmlns="http://maven.apache.org/

超詳細windows搭建安裝配置nexus教程--maven配置教程

  相信童鞋們知道nexus的肯定就知道maven這個東東了,maven的安裝教程我就不寫了,列位去找找別的教程吧,簡單的要死,這裡主要講解nexus的安裝教程, 1、先下載nexus,我使用的是war包,需要容器來執行的那種, 下載地址:https://sonatype-do

CentOS6.5 安裝Nexus配置Maven

1.下載Nexus的tar包,連結地址。注意,3.x版本需要JDK版本1.8及以上版本。2.建立安裝包存放目錄命令:mkdir -p /usr/local/src/installs3.rz或者ftp到伺服器目錄:/usr/local/src/installs4.解壓安裝包命令:tar -zxvf nexus-

Mavensetting.xml配置檔案詳解

setting.xml配置檔案 maven的配置檔案settings.xml存在於兩個地方: 1.安裝的地方:${M2_HOME}/conf/settings.xml 2.使用者的目錄:${user.home}/.m2/settings.xml 前者又被叫做全域性配置,對作

mavensetting.xml配置詳解

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="

CentOS安裝Nexus:(二)配置及使用Maven

前面一篇文章介紹Nexus的安裝,接下來介紹Nexus在專案開發中的使用。 一、訪問Nexus 訪問地址:http://ip:8081/nexus 賬號/密碼:admin/admin123 二、Nexus倉庫 nexus的倉庫型別分為以下四種: group: 倉庫組

maven安裝和eclipse整合以及Mavensetting.xml配置檔案詳解

由於maven需要JDK的支援,所以在安裝maven之前請確保電腦上已經安裝了JDK,且配置好了環境變數,具體的JDK的安裝及配置可自行百度。下面進入安裝 一、maven安裝 前面已經下載了相應版本的maven,且已經配置好JDK的環境;     1

Linux下的maven setting.xml配置

<?xml version="1.0" encoding="UTF-8"?><!--Licensed to the Apache Software Foundation (ASF) under oneor more contributor license a

mavensetting.xml 配置詳解

檔案存放位置 全域性配置: ${M2_HOME}/conf/settings.xml 使用者配置: ${user.home}/.m2/settings.xml note:使用者配置優先於全域性配置。${user.home} 和和所有其他系統屬性只能在3.0+版本上

maven下載jar包的流程及setting.xml配置映象

前面已經講解了配置nexus共享倉庫。啟動了nexus服務後,本地倉庫下載jar包都是從nexus裡下載,如果nexus裡沒有,nexus會與maven的中央倉庫打交道,然後下載對應的依賴包。當關閉了nexus服務後,本地倉庫就會跳過nexus,直接去maven

14、Maven配置

<settings> ... <mirrors> <mirror> <id>local_mirror</id> <mirrorOf>*</mirrorOf> <na

Maven專案setting.xml配置檔案詳解

Maven專案的setting.xml檔案,主要分為兩個: 使用者的安裝: ${user.home}/.m2/settings.xml 當前使用者範圍的配置檔案; Maven安裝: maven.conf/settings.xml全局範圍配置文件

mavennexus3.x環境配置

私服是指私有伺服器,是架設在區域網的一種特殊的遠端倉庫,目的是代理遠端倉庫及部署第三方構建。 有了私服之後,當 Maven 需要下載構件時,直接請求私服,私服上存在則下載到本地倉庫; 否則,私服請求外部的遠端倉庫,將構件下載到私服,再提供給本地倉庫下載。Nexus是一個強大的Maven倉庫管理器,它極大地簡化

Maven使用者手冊】Mavensetting.xml配置檔案詳解

setting.xml配置檔案 maven的配置檔案settings.xml存在於兩個地方: 1.安裝的地方:${M2_HOME}/conf/settings.xml 2.使用者的目錄:${user.home}/.m2/settings.xml 前者又被叫做全域性配置

maven禁用匿名訪問配置

2. 建立新使用者 3.在maven的setting.xml中配置新使用者賬號密碼 <server>         <id>public</id>  

nexus-3.6.0-02-unix.tar.gz安裝(Centos下),maven setting.xml配置案例,專案root的pom.xml配置,parent-pom的pom.xml配置案例

1、下載nexus 2、Centos下安裝Nexus 安裝JDK,此處略,檢查自己虛擬機器上的JDK版本如下: 使用xftp將nexus上傳到:/home/tuzq/software 首先解壓下載到的檔案: [[email