maven私服搭建
一、软件安装
地址:http://www.sonatype.org/nexus/thank-you-for-downloading/?dl=tgz
解压:
启动:
>> nexus start
打开:http://192.9.104.17:8081/nexus/#welcome
点击右上角,使用admin/admin123(默认管理员)登陆。
管理操作面板(修改代码库、镜像、用户权限管理等):
二、系统配置
默认的nexus 配置的镜像是无法使用的,需要我们把它设置为可行的,重新构建索引。
重新构建索引:
需要修改的仓库有三处:Central、Apache Snapshots、Codehaus Snapshots
另外,releases和snapshots两处的可以自动部署属性必须勾上,如下图:
当然,你也可以通过界面来上传jar包。
三、maven环境配置
1、确保你的环境中已经部署和正确配置了maven环境,具体如果安装maven不在此教程范畴之内。
2、到你当前登录的用户下的.m2目录下,创建一个setting.xml,内容如下:
- <?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>
- -->
- <!-- 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.
- |-->
- <servers>
- <!-- server
- | Specifies the authentication information to use when connecting to a particular server, identified by
- | a unique name within the system (referred to by the 'id' attribute below).
- |
- | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
- | used together.
- |
- <server>
- <id>deploymentRepo</id>
- <username>repouser</username>
- <password>repopwd</password>
- </server>
- -->
- <!-- Another sample, using keys to authenticate.
- <server>
- <id>siteServer</id>
- <privateKey>/path/to/private/key</privateKey>
- <passphrase>optional; leave empty if not used.</passphrase>
- </server>
- -->
- <server>
- <id>snapshots</id>
- <username>likehua</username>
- <password>likehua</password>
- </server>
- <server>
- <id>releases</id>
- <username>likehua</username>
- <password>likehua</password>
- </server>
- <server>
- <id>tomcat-remote-deploy</id>
- <username>tomcat</username>
- <password>tomcat123</password>
- </server>
- </servers>
- <!-- mirrors
- | This is a list of mirrors to be used in downloading artifacts from remote repositories.
- |
- | It works like this: a POM may declare a repository to use in resolving certain artifacts.
- | However, this repository may have problems with heavy traffic at times, so people have mirrored
- | it to several places.
- |
- | That repository definition will have a unique id, so we can create a mirror reference for that
- | repository, to be used as an alternate download site. The mirror site will be the preferred
- | server for that repository.
- |-->
- <mirrors>
- <!-- mirror
- | Specifies a repository mirror site to use instead of a given repository. The repository that
- | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
- | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
- |
- <mirror>
- <id>mirrorId</id>
- <mirrorOf>repositoryId</mirrorOf>
- <name>Human Readable Name for this Mirror.</name>
- <url>http://my.repository.com/repo/path</url>
- </mirror>
- -->
- <mirror>
- <id>nexus</id>
- <mirrorOf>*</mirrorOf>
- <name>A Local Nexus Server</name>
- <url>http://192.9.104.17:8081/nexus/content/groups/public/</url>
- </mirror>
- </mirrors>
- <!-- profiles
- | This is a list of profiles which can be activated in a variety of ways, and which can modify
- | the build process. Profiles provided in the settings.xml are intended to provide local machine-
- | specific paths and repository locations which allow the build to work in the local environment.
- |
- | For example, if you have an integration testing plugin - like cactus - that needs to know where
- | your Tomcat instance is installed, you can provide a variable here such that the variable is
- | dereferenced during the build process to configure the cactus plugin.
- |
- | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
- | section of this document (settings.xml) - will be discussed later. Another way essentially
- | relies on the detection of a system property, either matching a particular value for the property,
- | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
- | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
- | Finally, the list of active profiles can be specified directly from the command line.
- |
- | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
- | repositories, plugin repositories, and free-form properties to be used as configuration
- | variables for plugins in the POM.
- |
- |-->
- <profiles>
- <!-- profile
- | Specifies a set of introductions to the build process, to be activated using one or more of the
- | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
- | or the command line, profiles have to have an ID that is unique.
- |
- | An encouraged best practice for profile identification is to use a consistent naming convention
- | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
- | This will make it more intuitive to understand what the set of introduced profiles is attempting
- | to accomplish, particularly when you only have a list of profile id's for debug.
- |
- | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
- <profile>
- <id>jdk-1.4</id>
- <activation>
- <jdk>1.4</jdk>
- </activation>
- <repositories>
- <repository>
- <id>jdk14</id>
- <name>Repository for JDK 1.4 builds</name>
- <url>http://www.myhost.com/maven/jdk14</url>
- <layout>default</layout>
- <snapshotPolicy>always</snapshotPolicy>
- </repository>
- </repositories>
- </profile>
- -->
- <profile>
- <id>nexus</id>
- <repositories>
- <repository>
- <releases><enabled>true</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- <id>nexus</id>
- <name>Repository for Local Nexus Server</name>
- <url>http://central</url>
- <layout>default</layout>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <releases><enabled>true</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- <id>nexus</id>
- <name>Plugin Repository for Local Nexus Server</name>
- <url>http://central</url>
- </pluginRepository>
- </pluginRepositories>
- </profile>
- <!--
- | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
- | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
- | might hypothetically look like:
- |
- | ...
- | <plugin>
- | <groupId>org.myco.myplugins</groupId>
- | <artifactId>myplugin</artifactId>
- |
- | <configuration>
- | <tomcatLocation>${tomcatPath}</tomcatLocation>
- | </configuration>
- | </plugin>
- | ...
- |
- | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
- | anything, you could just leave off the <value/> inside the activation-property.
- |
- <profile>
- <id>env-dev</id>
- <activation>
- <property>
- <name>target-env</name>
- <value>dev</value>
- </property>
- </activation>
- <properties>
- <tomcatPath>/path/to/tomcat/instance</tomcatPath>
- </properties>
- </profile>
- -->
- </profiles>
- <!-- activeProfiles
- | List of profiles that are active for all builds.
- |
- <activeProfiles>
- <activeProfile>alwaysActiveProfile</activeProfile>
- <activeProfile>anotherAlwaysActiveProfile</activeProfile>
- </activeProfiles>
- -->
- </settings>
主要注意修改:servers和mirrors两处,如本例所示:
servers:
- <servers>
- <!-- server
- | Specifies the authentication information to use when connecting to a particular server, identified by
- | a unique name within the system (referred to by the 'id' attribute below).
- |
- | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
- | used together.
- |
- <server>
- <id>deploymentRepo</id>
- <username>repouser</username>
- <password>repopwd</password>
- </server>
- -->
- <!-- Another sample, using keys to authenticate.
- <server>
- <id>siteServer</id>
- <privateKey>/path/to/private/key</privateKey>
- <passphrase>optional; leave empty if not used.</passphrase>
- </server>
- -->
- <server>
- <id>snapshots</id>
- <username>likehua</username>
- <password>likehua</password>
- </server>
- <server>
- <id>releases</id>
- <username>likehua</username>
- <password>likehua</password>
- </server>
- <server>
- <id>tomcat-remote-deploy</id>
- <username>tomcat</username>
- <password>tomcat123</password>
- </server>
- </servers>
注意此处的用户名和密码,是你nexus上创建的用户名,一般付给部署的权限。
另外就是镜像地址的配置:
- <mirrors>
- <!-- mirror
- | Specifies a repository mirror site to use instead of a given repository. The repository that
- | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
- | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
- |
- <mirror>
- <id>mirrorId</id>
- <mirrorOf>repositoryId</mirrorOf>
- <name>Human Readable Name for this Mirror.</name>
- <url>http://my.repository.com/repo/path</url>
- </mirror>
- -->
- <mirror>
- <id>nexus</id>
- <mirrorOf>*</mirrorOf>
- <name>A Local Nexus Server</name>
- <url>http://192.9.104.17:/nexus/content/groups/public/</url>
- </mirror>
- </mirrors>
ok,maven私服搭建配置完成。
maven私服搭建的更多相关文章
- maven私服搭建(centOS6.5)
maven的好处和私服的应用本文不赘述,私服搭建如下: MAVEN 私服搭建(centOS 6.5 环境) 1. 准备环境,搭建centOS6.5系统环境,略 2. 准备对应的软件包如下: A. ...
- maven仓库总结,maven私服搭建
配置pom.xml依赖包时在这里找包的描述: http://search.maven.org/#browse 以java为根目录. mvn archtype:generate -DgroupId=zt ...
- window Maven私服搭建——nexus
注:本文来源于 <window Maven私服搭建--nexus> Maven私服搭建--nexus 1.下载nexus https://www.sonatype.com/downlo ...
- maven仓库总结,maven私服搭建,批量mvn eclipse:eclipse
配置pom.xml依赖包时在这里找包的描述: http://search.maven.org/#browse 以java为根目录. mvn archtype:generate -DgroupId=zt ...
- maven私服搭建&使用
Maven私服搭建教程 一.nexus安装 1,解压安装包 安装包下载地址 2,以管理员身份打开cmd 3,进入到nexus的bin目录 (1) 安装:nexus install (2) 启动:nex ...
- linux7下nenux3.14的maven私服搭建和配置使用
为什么用私服,各种帖子很多,话不多说,直接奉上本博主的搭建过程. 一.环境准备:确保jdk和maven安装完成 二.下载nenux:地址:https://www.sonatype.com/downlo ...
- Nexus Maven 私服搭建
1.下载Nexus安装文件:http://www.sonatype.org/nexus/go ,目前是nexus-2.13.0-01-bundle.tar.zip这个最新版本: 2.解压到任意目录,我 ...
- linux环境下jdk 安装以及maven私服搭建
1:准备资源 linux服务器,jdk和nexus 安装包 2:网络通畅,保持windows端和linux服务器端网络通畅. 3: 安装jdk和配置环境变量 进入到 ...
- maven私服搭建nexus/windows/linux(一)
为什么要搭建nexus私服,原因很简单,有些公司都不提供外网给项目组人员,因此就不能使用maven访问远程的仓库地址,还有就是公司内部开发的一些版本的jar包,如果没有私服需要一人拷贝一份然后再自己安 ...
随机推荐
- 离线安装swashbuckle(webapi自动文档及测试工具)
1.找到已经成功安装过的项目根目录的packages文件夹拷贝到新的项目的根目录 2.vs设置nuget程序包源 将源:地址改为新项目的packages文件夹 3.重新编译并修改代码 右键项目-> ...
- [moka同学笔记]Linux命令基本格式及目录处理命令
命令提示符 [root@localhost ~]# root:当前登录用户localhost:主机名~:当前所在的目录,此处为"家"目录#:root超级用户的提示符,如果是普通用户 ...
- java jni c++ 例子
1. java程序 public class TestHello { static { System.loadLibrary("TestHello"); } public stat ...
- Java--Jsp内置对象列表
- Three.js基础部分学习
一.关于使用Three.js几点理论说明 1.请参考官网地址 https://threejs.org/ 2.使用three.js必备条件 <场景 A scene.相机a camera.渲染器 a ...
- Html之 IFrame使用,注意几点
0x01 iframe的跳出框架 0x02 iframe样式设置 0x03 iframe重置高度 1.首先来一个,跳出iframe的好方法,直接可以在Login.aspx页面使用. if (windo ...
- HTML 定时页面跳转
有 2 种方法可以实现 html 的定时页面跳转,1.meta refresh 实现.2.JavaScript 实现. 1.通过 meta refresh 实现 3 秒后自动跳转到 http://ww ...
- jquery编写插件的方法
版权声明:作者原创,转载请注明出处! 编写插件的两种方式: 1.类级别开发插件(1%) 2.对象级别开发(99%) 类级别的静态开发就是给jquery添加静态方法,三种方式 1.添加新的全局函数 2 ...
- 基本排序算法——shell排序java实现
shell排序是对插入排序的一种改进. package basic.sort; import java.util.Arrays; import java.util.Random; public cla ...
- sqlite 数据类型
title: SQLITE 数据类型date: 2015-11-20 20:30:52categories: IOS tags: sqlite数据类型 小小程序猿我的博客:http://daycodi ...