---
title: "nexus maven svn 开发环境搭建"
author: "ppg"
date: "2012-10-02T23:59:58Z"
tags: []
categories: ["研发管理"]
slug: "nexus-maven-svn"
draft: false
lastmod: "2013-07-14T23:57:16Z"
id: 1689238
url: "https://ppg.iteye.com/blog/1689238"
---

引：闲来无事，在个人pc机上尝试了一下类似于工作中的开发环境。
参考了网上各种版本，加以操作，最后搭建完毕，并把部署过程记录下来。
整个过程没有什么的难点，只是走一个搭建的流程。
有理解不对的地方，请指正


1.安装 Maven
1.1 resource: url = http://maven.apache.org/download.html
eg. Down apache-maven-3.0.4-bin.zip
extract .zip to local

1.2 enviroment config
eg. My maven home path= E:\maven
add environment as below:
MAVEN_HOME=E:\maven
Make sure JAVA_HOME is already in your environment
Add Path=….. ;%MAVEN%/bin;
Finally open cmd to test mvn , you can input this command :mvn –v 
If the following information appear on your screen.that indicated maven has been installed successfully.

![](http://dl.iteye.com/upload/attachment/0074/5804/7f4319af-d404-3239-b510-3502031f950f.png)

2.安装 Eclipse Maven plugin 
2.1 auto install
url =http://download.eclipse.org/technology/m2e/releases

![](http://dl.iteye.com/upload/attachment/0074/5806/79e99d37-4c08-3d89-874a-66543cbcd405.png)

The install time may be tens of minutes.
And then restart eclipse to check whether the m2eclipse-plugin has been installed successfully or not.

3,安装nexus 服务 version=2.1.2
3.1 offical website= http://www.sonatype.org/nexus/
   Down page= http://www.sonatype.org/nexus/go
Down url= http://www.sonatype.org/downloads/nexus-2.1.2-bundle.zip
3.2 extract .zip to local
File directory as below:

![](http://dl.iteye.com/upload/attachment/0074/5808/99da709a-6407-3b84-ae33-110a2891c674.png)

![](http://dl.iteye.com/upload/attachment/0074/5810/739b761c-ad06-3ce9-a8ba-4dcf55f1f4e5.png)

3.3 config nexus.properties
Dir = nexus-2.1.2-bundle\nexus-2.1.2\conf\nexus.properties
Config as below

```java

# Jetty section
application-port=8081
application-host=127.0.0.1
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus

# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF
pr.encryptor.publicKeyPath=/apr/public-key.txt

```


3.4 start service
Eg.my os is win7 X64 
Dir= E:\nexus-2.1.2-bundle\nexus-2.1.2\bin\jsw\windows-x86-64
Chick sequence as below:
![](http://dl.iteye.com/upload/attachment/0074/5812/245e1859-953e-3011-9e80-e42363656c8d.png)

3.4.1 install-nexus.bat

3.4.2 console-nexus.bat

![](http://dl.iteye.com/upload/attachment/0074/5814/da658731-02b8-3226-9bc2-8cee90a40454.png)

3.5 Test url=http://127.0.0.1:8081/nexus/
If entry the homepage with no problems ,that indicate Nexus has been started successfully 

3.6 login with administrator account.  Default is :username= admin / password=admin123

3.7 config Repositories 
Eg. Central,Releases,Snapshots

![](http://dl.iteye.com/upload/attachment/0074/5816/506c87e5-c4d7-3426-84b7-0a59723fbba1.png)
Check “Remote Storage Location URL” and “Download Remote Indexes” configuration.

![](http://dl.iteye.com/upload/attachment/0074/5818/45ef1744-27ec-3329-94ca-b3e02a1f8c57.png)
Click the right mouse button and select “Repair Index” and “Update Index”
If your network is ok and then the following picture will appear:

![](http://dl.iteye.com/upload/attachment/0074/5820/01ade4c2-dfef-36c9-9afe-739b5d2b7dfb.png)
That indicate the index with maven repositories has been updated. And then you can search lib with nexus.

4. 整合Eclipse和Nexus

4.1 config Maven settings.xml

4.1.1 Add loical repository as below: 


```java

<localRepository>E:/repo</localRepository>

```


4.1.2 add server in servers:


```java

<servers>
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->
	  <server>
      <id>releases</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
      <server>
      <id>snapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>

```


4.1.3 add profiles and activeProfiles:


```java

 <profiles>
	 <profile>
       <id>dev</id>
          <repositories>
             <repository>
                 <id>nexus</id>
                 <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
                 <releases>
                    <enabled>true</enabled>
                 </releases>
                 <snapshots>
                    <enabled>true</enabled>
                 </snapshots>
              </repository>
            </repositories>           
            <pluginRepositories>
                <pluginRepository>
                    <id>nexus</id>
                    <url>http://127.0.0.1:8081/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
  </profiles>
      <activeProfiles>
        <activeProfile>dev</activeProfile>
    </activeProfiles>

```


4.1.4 all settings.xml like this:


```java

<?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>
E:/repo
</localRepository>
  <pluginGroups>
  </pluginGroups>
  <servers>
	  <server>
      <id>releases</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
      <server>
      <id>snapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>
  <profiles>
	 <profile>
       <id>dev</id>
          <repositories>
             <repository>
                 <id>nexus</id>
                 <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
                 <releases>
                    <enabled>true</enabled>
                 </releases>
                 <snapshots>
                    <enabled>true</enabled>
                 </snapshots>
              </repository>
            </repositories>           
            <pluginRepositories>
                <pluginRepository>
                    <id>nexus</id>
                    <url>http://127.0.0.1:8081/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
  </profiles>
      <activeProfiles>
        <activeProfile>dev</activeProfile>
    </activeProfiles>
</settings>

```


4.2 change eclipse setting

4.2.1 use your installed maven 

![](http://dl.iteye.com/upload/attachment/0074/5822/3da28d90-f9c0-3579-8dd9-49f7d3d59c05.png)

4.2.2 select source xml: 

![](http://dl.iteye.com/upload/attachment/0074/5824/fe3a9108-d62c-3095-9b10-8cc5f6557925.png)

4.2.3 click  “Update Settings”

4.3  create a new project to test

4.3.1 create a nomal java project or directly create a maven project
If you create a nomal java project,then convert it to a Maven project as below

![](http://dl.iteye.com/upload/attachment/0074/5828/126fe6b7-8844-3915-9556-4cb1a347b05f.png)

4.3.2 install your project 

![](http://dl.iteye.com/upload/attachment/0074/5830/77f00c6e-608e-3f1a-874e-a49bbe3922ea.png)

If no problem that indicate your config is correct.

4.4 snapshot and release

4.4.1 add elements to your project pom.xml as below:


```java

<distributionManagement>
  <repository>
    <id>releases</id>
    <url>http://127.0.0.1:8081/nexus/content/repositories/releases</url>
  </repository>
   <snapshotRepository>
    <id>snapshots</id>
    <url>http://127.0.0.1:8081/nexus/content/repositories/snapshots</url>
  </snapshotRepository>
</distributionManagement>

```


Full pom.xml may be like this:

![](http://dl.iteye.com/upload/attachment/0074/5834/eaeaf718-6547-37af-9bfc-d56c2d50021a.png)

4.1.2 Then run maven command “deploy” 

![](http://dl.iteye.com/upload/attachment/0074/5836/042a98d6-fe11-35f5-8611-38d10f98273b.png)

Run this and following information will appear:


![](http://dl.iteye.com/upload/attachment/0074/5848/3fe0a379-f7d8-3137-a453-c8c689af9e55.png)


Then open nexus home page , you can find the snapshot version.


![](http://dl.iteye.com/upload/attachment/0074/5850/917a0c47-c8cb-34ce-8155-98981ad2fbb8.png)

4.1.3 deploy release version
Change the pom.xml as :


![](http://dl.iteye.com/upload/attachment/0074/5852/872d0d3e-1f8b-3561-bb50-533710ed862a.png)

Then run deploy command as last.

![](http://dl.iteye.com/upload/attachment/0074/5838/be075701-8f84-3ffd-a39a-44e69361b20b.png)


![](http://dl.iteye.com/upload/attachment/0074/5840/5470445b-0b59-3274-8c32-6d38ff99e4ff.png)


5 安装svn

5.1 svn server down url=http://www.visualsvn.com/downloads/  
Choice VisualSVN Server
One step by one step follow by windows setup information.


![](http://dl.iteye.com/upload/attachment/0074/5842/050403ac-9f58-3b11-a033-637b5e6317d2.png)

5.2 svn client http://tortoisesvn.net/downloads.html#
Down install software and language packs

![](http://dl.iteye.com/upload/attachment/0074/5844/3a01451c-78c7-3a0e-91e4-186a24886e81.png)

Like this, all steps are easy and clearly

Over 
thx all.