maven配置文件settings.xml详解

顶级元素

<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
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>      # 本地仓库路径
  <interactiveMode/>      # 是否需要和用户交互以获得输入
  <usePluginRegistry/>    # 
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors/>
  <proxies/>
  <profiles/>
  <activeProfiles/>
</settings>

1.声明规范

<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">

2.localRepository

3.interactiveMode

4.usePluginRegistry

5.offline

6.pluginGroups

7.proxies

8.servers


    <servers>
      
      <server>
       
       <id>server001id>
       
       <username>my_loginusername>
       
       <password>my_passwordpassword>
       
       <privateKey>${usr.home}/.ssh/id_dsaprivateKey>
       
       <passphrase>some_passphrasepassphrase>
       
       <filePermissions>664filePermissions>
       
       <directoryPermissions>775directoryPermissions>
      server>
    servers>

9.mirrors


    <mirrors>
      
      <mirror>
       
       <id>planetmirror.comid>
       
       <name>PlanetMirror Australianame>
       
       <url>http://downloads.planetmirror.com/pub/maven2url>
       
       <mirrorOf>centralmirrorOf>
      mirror>
    mirrors>

10.profiles


    <profiles>
      
      <profile>
       
       <id>testid>

11.Activation

12.Repositories

13.activeProfiles

参考示例

<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>/opt/repository/mavenlocalRepository>
  

  

  
  <pluginGroups>
    
  pluginGroups>

  
  <proxies>
    
  proxies>

  
  <servers>
    

    
 <server>
        <id>nexusid>
        <username>adminusername>
        <password>admin123password>
    server>
    <server>
        <id>releasesid>
        <username>adminusername>
        <password>anonymous123password>
    server>
    <server>
        <id>snapshotsid>
        <username>adminusername>
        <password>anonymous123password>
    server>
        <server>
            <id>thirdpartyid>
            <username>adminusername>
            <password>anonymous123password>
        server>
  servers>

  
  <mirrors>
    
        <mirror>
            <id>nexusid>
            <name>internal nexus repositoryname>
            <url>http://10.0.0.241:9999/repository/maven-public/url> 
            <mirrorOf>*mirrorOf> 
        mirror> 
  mirrors>

  
  <profiles>
    

    
<profile> 
<id>apatchid> 
<repositories> 
<repository> 
<id>re-apatchid> 
<name>remote apatchname> 
<url>http://inno.starhubdev.com/nexus/content/groups/public/url>
<releases>
<enabled>trueenabled>
releases>
<snapshots>
<enabled>trueenabled> 
snapshots>
repository>
repositories> 
profile> 
<profile> 
<id>ibiblioid> 
<repositories> 
<repository> 
<id>re-ibiblioid> 
<name>remote ibiblioname> 
<url>https://nexus.sourcesense.com/nexus/content/repositories/public/url> 
<releases>
<enabled>trueenabled>
releases>
<snapshots>
<enabled>trueenabled>
snapshots>
repository> 
repositories> 
profile> 
<profile> 
<id>redevid> 
<repositories> 
<repository> 
<id>re-nexusid> 
<name>remote nexusname> 
<url>http://repository.sonatype.org/content/groups/public/url> 
<releases>
<enabled>trueenabled>
releases>
<snapshots>
<enabled>trueenabled>
snapshots>
repository> 
repositories> 
profile> 
<profile>
            <id>devid>
            <repositories>
                <repository>
                    <id>nexusid>
                    <url>http://10.0.0.241:9999/nexus/content/groups/publicurl>
                    <releases><enabled>trueenabled>releases>
                    <snapshots><enabled>trueenabled>snapshots>
                repository>
            repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>nexusid>
                    <url>http://10.0.0.241:9999/nexus/content/groups/publicurl>
                    <releases><enabled>trueenabled>releases>
                    <snapshots><enabled>trueenabled>snapshots>
                pluginRepository>
            pluginRepositories>
    profile>
  profiles>
  
settings>

localRepository标签

servers

你可能感兴趣的:(工作记录,maven,xml,java)