安装maven私服

在nexus官网下载,我的windows版本是nexus-2.14.5-02-bundle.tar

linux版本是nexus-3.7.0-04-unix.tar.gz

下载地址:https://www.sonatype.com/download-oss-sonatype

linux版本nexus 3.x版本为了集成docter和之前操作不一致,换成2.x版本

 

nexus依赖maven、jdk。

修改maven的setting文件为如下配置,增加<server> <repositories>标签的相关配置

 

<?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
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->


  <localRepository>E:\m2\repository</localRepository>


  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->


  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->


  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
  </pluginGroups>


  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>


  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->


  <mirrors>
<!--
    <mirror>
      <id>nexus</id>
      <mirrorOf>thirdparty,releases,snapshots</mirrorOf>
      <name>chinadaas-repository</name>
      <url>http://192.168.11.20:8081/nexus/content/groups/public</url>
    </mirror>
-->
  </mirrors> 


    <servers>  
        <server>  
            <id>nuoyuan_releases</id>  
            <username>admin</username>  
            <password>admin123</password>  
        </server>  
		 <server>  
            <id>nuoyuan_snapshots</id>  
            <username>admin</username>  
            <password>admin123</password>  
        </server> 
    </servers>  


  <profiles>


    <profile>
       <id>jdk-1.8</id>
       <activation>
         <activeByDefault>true</activeByDefault>
         <jdk>1.8</jdk>
       </activation>
       <properties>
           <maven.compiler.source>1.8</maven.compiler.source>
           <maven.compiler.target>1.8</maven.compiler.target>
           <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
       </properties>
    </profile>


    <profile>
      <id>nuoyuan</id>
      <properties>
        <downloadSources>true</downloadSources>
        <downloadJavadocs>true</downloadJavadocs>
      </properties>
      <repositories>
	  	<repository>  
                <id>nuoyuan</id>  
                <name>nuoyuan</name>  
                <url>http://localhost:8081/nexus/content/groups/public/</url>  
                <releases>  
                    <enabled>true</enabled>  
                </releases>  
                <snapshots>  
                    <enabled>true</enabled>  
                </snapshots>  
         </repository> 
        <repository>
          <id>central</id>
          <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
            <updatePolicy>never</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
		<pluginRepository>  
                <id>nuoyuan</id>  
                <name>nuoyuan</name>  
                <url>http://localhost:8081/nexus/content/groups/public/</url>  
                <releases>  
                    <enabled>true</enabled>  
                </releases>  
                <snapshots>  
                    <enabled>true</enabled>  
                </snapshots>  
            </pluginRepository>
        <pluginRepository>
          <id>central</id>
          <!-- <url>http://repo1.maven.org/maven2/</url> -->
          <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
            <updatePolicy>never</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>


  <activeProfiles>
      <activeProfile>jdk-1.8</activeProfile>
      <activeProfile>nuoyuan</activeProfile>
  </activeProfiles>


</settings>
		 <server>  
            <id>nuoyuan_snapshots</id>  
            <username>admin</username>  
            <password>admin123</password>  
        </server> 
    </servers>  


  <profiles>


    <profile>
       <id>jdk-1.8</id>
       <activation>
         <activeByDefault>true</activeByDefault>
         <jdk>1.8</jdk>
       </activation>
       <properties>
           <maven.compiler.source>1.8</maven.compiler.source>
           <maven.compiler.target>1.8</maven.compiler.target>
           <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
       </properties>
    </profile>


    <profile>
      <id>nuoyuan</id>
      <properties>
        <downloadSources>true</downloadSources>
        <downloadJavadocs>true</downloadJavadocs>
      </properties>
      <repositories>
	  	<repository>  
                <id>nuoyuan</id>  
                <name>nuoyuan</name>  
                <url>http://localhost:8081/nexus/content/groups/public/</url>  
                <releases>  
                    <enabled>true</enabled>  
                </releases>  
                <snapshots>  
                    <enabled>true</enabled>  
                </snapshots>  
         </repository> 
        <repository>
          <id>central</id>
          <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
            <updatePolicy>never</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
		<pluginRepository>  
                <id>nuoyuan</id>  
                <name>nuoyuan</name>  
                <url>http://localhost:8081/nexus/content/groups/public/</url>  
                <releases>  
                    <enabled>true</enabled>  
                </releases>  
                <snapshots>  
                    <enabled>true</enabled>  
                </snapshots>  
            </pluginRepository>
        <pluginRepository>
          <id>central</id>
          <!-- <url>http://repo1.maven.org/maven2/</url> -->
          <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
            <updatePolicy>never</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>


  <activeProfiles>
      <activeProfile>jdk-1.8</activeProfile>
      <activeProfile>nuoyuan</activeProfile>
  </activeProfiles>


</settings>

 

 

启动maven,windown执行bin/nexus.bat, linux 执行bin/nexus start 或者 run&

访问http://localhost8081/nexus  用户名密码 admin admin123

不登录查看deploy包 http://10.80.111.214:8081/nexus/content/groups/

点击右侧repositories→点击central→点击configuration→download remote indexs 设置为true 


修改本机maven的setting文件

 

<servers>  
        <server>  
            <id>nuoyuan_releases</id>  
            <username>admin</username>  
            <password>admin123</password>  
        </server>  
		 <server>  
            <id>nuoyuan_snapshots</id>  
            <username>admin</username>  
            <password>admin123</password>  
        </server> 
</servers>

加入:
<repository>
<id>nuoyuan</id>
<name>nuoyuan</name>
<url>http://*.*.*.*:8081/nexus/content/groups/public</url> <releases><enabled>true</enabled><updatePolicy>never</updatePolicy></releases>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</repository>

加入:
<pluginRepository>
<id>nuoyuan</id>
<name>nuoyuan</name>
<url>http://*.*.*.*:8081/nexus/content/groups/public/</url> <releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>

 

 

修改pom文件

 

<distributionManagement>
    <repository>
        <id>nuoyuan_releases</id>
        <name>core Release Repository</name>
        <url>http://*.*.*.*:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>nuoyuan_snapshots</id>
        <name>core Snapshots Repository</name>
        <url>http://*.*.*.*:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

 

 

更新

nexus默认安装目录 /usr/local/nexus ,同级目录有个sonatype-work用来存取备份等信息,会越来越大

迁移到挂载目录,修改conf目录下的nexus.properties

#
# Sonatype Nexus (TM) Open Source Version
# Copyright (c) 2008-present Sonatype, Inc.
# All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
#
# This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
# which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
#
# Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
# of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
# Eclipse Foundation. All other trademarks are the property of their respective owners.
#

# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus.

# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus

# Nexus section
nexus-work=/mnt/.m2/sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF

# orientdb buffer size in megabytes
storage.diskCache.bufferSize=4096

 

 

 

 

 

参考博客:http://blog.csdn.net/atco/article/details/51721271

        

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值