搭建Maven私服――nexus

下载地址:http://www.sonatype.org/nexus/archived/#step2top

我本次安装版本是:Nexus 2.11.4-01


1、maven的全局配置文件:

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

<localRepository>D:\greensoft\apache-maven-3.2.3-bin\apache-maven-3.2.3\repo</localRepository>

<pluginGroups>
</pluginGroups>

<proxies>
</proxies>

 
<servers>
	<server>
		<id>cninfo-release</id>
		<username>deployment</username>
		<password>xxxxxx</password>
	</server>
	<server>
		<id>cninfo-snapshot</id>
		<username>deployment</username>
		<password>xxxxxx</password>
	</server>
</servers>


   
<mirrors>

 <mirror>
      <id>central</id>
      <mirrorOf>*</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://xxx.xxx.xxx.xx:8089/nexus/content/groups/xxxx_group</url>
 </mirror>
	  
</mirrors>
  

<profiles>
    <profile>
	<id>cninfo_group</id>
	<repositories>
		<repository>
			<id>cninfo_group</id>
			<name>cninfo_group_repo</name>
			<url>http://xxx.xxx.xxx.xx:8089/nexus/content/groups/xxxx_group</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
	<pluginRepositories>
         <pluginRepository>
           <id>cninfo_group</id>
          <name>cninfo_group_repo</name>
            <url>http://xxx.xxx.xxx.xx:8089/nexus/content/groups/cninfo_group</url>
               <releases><enabled>true</enabled></releases>
               <snapshots><enabled>true></enabled></snapshots>
       </pluginRepository>
      </pluginRepositories>
					 
  </profile>
	<profile>  
		<id>downloadSources</id>  
		<properties>  
			<downloadSources>true</downloadSources>  
			<downloadJavadocs>true</downloadJavadocs>             
		</properties>  
	</profile>  
  </profiles>

 
  
<activeProfiles>
        <activeProfile>cninfo_group</activeProfile>
		<activeProfile>downloadSources</activeProfile>  
</activeProfiles>

</settings>


2、如果有项目需要发布到nexus服务器中,需在pom.xml添加如下的配置

<dependencies>
...
</dependencies>


<distributionManagement>
    <repository>
        <id>cninfo-release</id>
        <name>cninfo-release-repo</name>
        <url>http://xxx.xxx.xxx.xx::8089/nexus/content/repositories/cninfo-release</url>
    </repository>
    <snapshotRepository>
        <id>cninfo-snapshot</id>
        <name>cninfo-snapshot-repo</name>
        <url>http://xxx.xxx.xxx.xx::8089/nexus/content/repositories/cninfo-snapshot</url>
        </snapshotRepository>
</distributionManagement>

<build>
...
</build>



你可能感兴趣的:(nexus,搭建Maven私服)