【原创】maven + nexus 的settings.xml配置实例

[原创]

1. settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<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">

  <pluginGroups/>
  <proxies/>
  <servers/>
  <mirrors/>

  <profiles>
    <profile> 
      <id>nexus</id> 
      <repositories> 
        <repository> 
            <id>nexus</id> 
            <name>local private nexus</name> 
            <url>http://localhost:8080/nexus/content/groups/public</url> 
            <releases><enabled>true</enabled></releases> 
            <snapshots><enabled>false</enabled></snapshots> 
        </repository> 
        <repository> 
            <id>nexus</id> 
            <name>local private nexus</name> 
            <url>http://localhost:8080/nexus/content/groups/public-snapshots</url> 
            <releases><enabled>false</enabled></releases> 
            <snapshots><enabled>true</enabled></snapshots> 
        </repository> 
      </repositories> 
      <pluginRepositories> 
        <pluginRepository> 
            <id>nexus</id> 
            <name>local private nexus</name> 
            <url>http://localhost:8080/nexus/content/groups/public</url> 
            <releases><enabled>true</enabled></releases> 
            <snapshots><enabled>false</enabled></snapshots> 
        </pluginRepository> 
        <pluginRepository> 
            <id>nexus</id> 
            <name>local private nexus</name> 
            <url>http://localhost:8080/nexus/content/groups/public-snapshots</url> 
            <releases><enabled>false</enabled></releases> 
            <snapshots><enabled>true</enabled></snapshots> 
        </pluginRepository> 
       </pluginRepositories> 
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>nexus</activeProfile> 
  </activeProfiles>

</settings>

2. 在使用IDE时需要更新indices ,在使用idea时需要修改 bin\idea.exe.vmoptions 增加以下内容:

   

-Dhttp.proxyHost=localhost
-Dhttp.proxyPort=8080
-Dhttp.nonProxyHosts=localhost

   否则无法在IDE中更新indices,总是报告找不到文件的错误。 eclipse中未进行尝试,有机会尝试后补充。

3. nexus的最佳实践推荐每一个项目自定义一个group便于管理。

猜你喜欢

转载自rept.iteye.com/blog/693521