1.私服搭建环境

  在Linux系统中,我选择比较方便下载安装docker容器,具体安装步骤可以根据Docker菜鸟教程安装自己需要的镜像。在这里我们先选择

Docker 安装 Nginx。这里就不做具体步骤讲解。

2.私服设置

  私服搭建完成,我们输入默认用户名/密码:admin/admin123进入首页选择设置

 

 在设置里面选择Repositories 创建自己本地仓库,在本例中我创建了两个自己的仓库wessence-releases和wessence-snapshots,并创建了一个分组wessence-public方便后续管理。

  对应我创建的仓库,在这里对仓库类型做下简要说明:

   hosted,本地仓库,通常我们会部署自己的构件到这一类型的仓库。比如公司的第二方库。

  proxy,代理仓库,它们被用来代理远程的公共仓库,如maven中央仓库。

  group,仓库组,用来合并多个hosted/proxy仓库,当你的项目希望在多个repository使用资源时就不需要多次引用了,只需要引用一个group即可。

 对于仓库的创建,wessence-releases和wessence-snapshots创建方式一样,我们以wessence-releases为例

  创建仓库分组,选择maven2(group)类型进行创建。

私服基础设置都这里设置完成,下面我们设置一下使用的settings和pom参数。下面是settings设置

  1 <?xml version="1.0" encoding="UTF-8" ?>
2
3 <!--
4 Licensed to the Apache Software Foundation (ASF) under one
5 or more contributor license agreements. See the NOTICE file
6 distributed with this work for additional information
7 regarding copyright ownership. The ASF licenses this file
8 to you under the Apache License, Version 2.0 (the
9 "License"); you may not use this file except in compliance
10 with the License. You may obtain a copy of the License at
11
12 http://www.apache.org/licenses/LICENSE-2.0
13
14 Unless required by applicable law or agreed to in writing,
15 software distributed under the License is distributed on an
16 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 KIND, either express or implied. See the License for the
18 specific language governing permissions and limitations
19 under the License.
20 -->
21
22 <!--
23 | This is the configuration file for Maven. It can be specified at two levels:
24 |
25 | 1. User Level. This settings.xml file provides configuration for a single user,
26 | and is normally provided in ${user.home}/.m2/settings.xml.
27 |
28 | NOTE: This location can be overridden with the CLI option:
29 |
30 | -s /path/to/user/settings.xml
31 |
32 | 2. Global Level. This settings.xml file provides configuration for all Maven
33 | users on a machine (assuming they're all using the same Maven
34 | installation). It's normally provided in
35 | ${maven.home}/conf/settings.xml.
36 |
37 | NOTE: This location can be overridden with the CLI option:
38 |
39 | -gs /path/to/global/settings.xml
40 |
41 | The sections in this sample file are intended to give you a running start at
42 | getting the most out of your Maven installation. Where appropriate, the default
43 | values (values used when the setting is not specified) are provided.
44 |
45 |-->
46 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
47 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
48 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
49 <!-- localRepository
50 | The path to the local repository maven will use to store artifacts.
51 |
52 | Default: ${user.home}/.m2/repository
53 <localRepository>/path/to/local/repo</localRepository>
54 -->
55 <!--自定义本地仓库路径-->
56 <localRepository>D:\dev\localwar\local</localRepository>
57 <!-- interactiveMode
58 | This will determine whether maven prompts you when it needs input. If set to false,
59 | maven will use a sensible default value, perhaps based on some other setting, for
60 | the parameter in question.
61 |
62 | Default: true
63 <interactiveMode>true</interactiveMode>
64 -->
65
66 <!-- offline
67 | Determines whether maven should attempt to connect to the network when executing a build.
68 | This will have an effect on artifact downloads, artifact deployment, and others.
69 |
70 | Default: false
71 <offline>false</offline>
72 -->
73
74 <!-- pluginGroups
75 | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
76 | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
77 | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
78 |-->
79 <pluginGroups>
80 <!-- pluginGroup
81 | Specifies a further group identifier to use for plugin lookup.
82 <pluginGroup>com.your.plugins</pluginGroup>
83 -->
84 </pluginGroups>
85
86 <!-- proxies
87 | This is a list of proxies which can be used on this machine to connect to the network.
88 | Unless otherwise specified (by system property or command-line switch), the first proxy
89 | specification in this list marked as active will be used.
90 |-->
91 <proxies>
92 <!-- proxy
93 | Specification for one proxy, to be used in connecting to the network.
94 |
95 <proxy>
96 <id>optional</id>
97 <active>true</active>
98 <protocol>http</protocol>
99 <username>proxyuser</username>
100 <password>proxypass</password>
101 <host>proxy.host.net</host>
102 <port>80</port>
103 <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
104 </proxy>
105 -->
106 </proxies>
107
108 <!-- servers
109 | This is a list of authentication profiles, keyed by the server-id used within the system.
110 | Authentication profiles can be used whenever maven must make a connection to a remote server.
111 |-->
112 <servers>
113 <!-- server
114 | Specifies the authentication information to use when connecting to a particular server, identified by
115 | a unique name within the system (referred to by the 'id' attribute below).
116 |
117 | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
118 | used together.
119 |
120 -->
121 <server>
122 <!--id 自己设置,但是必须与pom文件中引入仓库的id一直,username,与password 是登录私服的用户名密码-->
123 <id>releases</id>
124 <username>admin</username>
125 <password>admin123</password>
126 </server>
127
128 <server>
129 <id>snapshots</id>
130 <username>admin</username>
131 <password>admin123</password>
132 </server>
133
134
135
136 <!-- Another sample, using keys to authenticate.
137 <server>
138 <id>release</id>
139 <privateKey>/path/to/private/key</privateKey>
140 <passphrase>optional; leave empty if not used.</passphrase>
141 </server>
142 -->
143 </servers>
144
145 <!-- mirrors
146 | This is a list of mirrors to be used in downloading artifacts from remote repositories.
147 |
148 | It works like this: a POM may declare a repository to use in resolving certain artifacts.
149 | However, this repository may have problems with heavy traffic at times, so people have mirrored
150 | it to several places.
151 |
152 | That repository definition will have a unique id, so we can create a mirror reference for that
153 | repository, to be used as an alternate download site. The mirror site will be the preferred
154 | server for that repository.
155 |-->
156 <mirrors>
157 <!-- mirror
158 | Specifies a repository mirror site to use instead of a given repository. The repository that
159 | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
160 | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
161 |
162 <mirror>
163 <id>mirrorId</id>
164 <mirrorOf>repositoryId</mirrorOf>
165 <name>Human Readable Name for this Mirror.</name>
166 <url>http://my.repository.com/repo/path</url>
167 </mirror>
168 -->
169 </mirrors>
170
171 <!-- profiles
172 | This is a list of profiles which can be activated in a variety of ways, and which can modify
173 | the build process. Profiles provided in the settings.xml are intended to provide local machine-
174 | specific paths and repository locations which allow the build to work in the local environment.
175 |
176 | For example, if you have an integration testing plugin - like cactus - that needs to know where
177 | your Tomcat instance is installed, you can provide a variable here such that the variable is
178 | dereferenced during the build process to configure the cactus plugin.
179 |
180 | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
181 | section of this document (settings.xml) - will be discussed later. Another way essentially
182 | relies on the detection of a system property, either matching a particular value for the property,
183 | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
184 | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
185 | Finally, the list of active profiles can be specified directly from the command line.
186 |
187 | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
188 | repositories, plugin repositories, and free-form properties to be used as configuration
189 | variables for plugins in the POM.
190 |
191 |-->
192 <profiles>
193 <!-- profile
194 | Specifies a set of introductions to the build process, to be activated using one or more of the
195 | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
196 | or the command line, profiles have to have an ID that is unique.
197 |
198 | An encouraged best practice for profile identification is to use a consistent naming convention
199 | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
200 | This will make it more intuitive to understand what the set of introduced profiles is attempting
201 | to accomplish, particularly when you only have a list of profile id's for debug.
202 |
203 | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
204 <profile>
205 <id>jdk-1.4</id>
206
207 <activation>
208 <jdk>1.4</jdk>
209 </activation>
210
211 <repositories>
212 <repository>
213 <id>jdk14</id>
214 <name>Repository for JDK 1.4 builds</name>
215 <url>http://www.myhost.com/maven/jdk14</url>
216 <layout>default</layout>
217 <snapshotPolicy>always</snapshotPolicy>
218 </repository>
219 </repositories>
220 </profile>
221 -->
222
223 <!--
224 | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
225 | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
226 | might hypothetically look like:
227 |
228 | ...
229 | <plugin>
230 | <groupId>org.myco.myplugins</groupId>
231 | <artifactId>myplugin</artifactId>
232 |
233 | <configuration>
234 | <tomcatLocation>${tomcatPath}</tomcatLocation>
235 | </configuration>
236 | </plugin>
237 | ...
238 |
239 | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
240 | anything, you could just leave off the <value/> inside the activation-property.
241 |
242
243 <profile>
244 <id>env-dev</id>
245
246 <activation>
247 <property>
248 <name>target-env</name>
249 <value>dev</value>
250 </property>
251 </activation>
252
253 </profile>
254 -->
255
256 <profile>
257 <!--激活仓库的唯一标识,自己设置名称 -->
258 <id>wessence_profile</id>
259 <repositories>
260 <!--包含需要连接到远程仓库的信息。id,name自己设置,不用和私服上的仓库名称致.在这个我们可以只设置我们的分组地址就可以了,具体引用到pom去设置 -->
261 <repository>
262 <!--远程仓库唯一标识 -->
263 <id>wessence-public</id>
264 <!--远程仓库名称 -->
265 <name>wessence-public</name>
266 <!--如何处理远程仓库里发布版本的下载 -->
267 <releases>
268 <!--true或者false表示该仓库是否为下载某种类型构件(发布版,快照版)开启。 -->
269 <enabled>true</enabled>
270 <!--该元素指定更新发生的频率。Maven会比较本地POM和远程POM的时间戳。这里的选项是:always(一直),daily(默认,每日),interval:X(这里X是以分钟为单位的时间间隔),或者never(从不)。 -->
271 <updatePolicy>never</updatePolicy>
272 <!--当Maven验证构件校验文件失败时该怎么做-ignore(忽略),fail(失败),或者warn(警告)。 -->
273 <checksumPolicy>warn</checksumPolicy>
274 </releases>
275 <!--如何处理远程仓库里快照版本的下载。有了releases和snapshots这两组配置,POM就可以在每个单独的仓库中,为每种类型的构件采取不同的策略。例如,可能有人会决定只为开发目的开启对快照版本下载的支持。参见repositories/repository/releases元素 -->
276 <snapshots>
277 <!--true或者false表示该仓库是否为下载某种类型构件(发布版,快照版)开启。 -->
278 <enabled>true</enabled>
279 <!--该元素指定更新发生的频率。Maven会比较本地POM和远程POM的时间戳。这里的选项是:always(一直),daily(默认,每日),interval:X(这里X是以分钟为单位的时间间隔),或者never(从不)。 -->
280 <updatePolicy>always</updatePolicy>
281 <!--当Maven验证构件校验文件失败时该怎么做-ignore(忽略),fail(失败),或者warn(警告)。 -->
282 <checksumPolicy>warn</checksumPolicy>
283 </snapshots>
284 <!--远程仓库URL,按protocol://hostname/path形式 -->
285 <url>http://自己ip或者域名:8081/repository/wessence-public/</url>
286 <!--用于定位和排序构件的仓库布局类型-可以是default(默认)或者legacy(遗留)。Maven 2为其仓库提供了一个默认的布局;然而,Maven 1.x有一种不同的布局。我们可以使用该元素指定布局是default(默认)还是legacy(遗留)。 -->
287 <layout>default</layout>
288 </repository>
289 </repositories>
290
291 <pluginRepositories>
292 <pluginRepository>
293 <id>wessence-group</id>
294 <name>Maven China Mirror</name>
295 <url>http://自己ip或者域名:8081/repository/wessence-public/</url>
296 <releases>
297 <enabled>true</enabled>
298 </releases>
299 <snapshots>
300 <enabled>true</enabled>
301 </snapshots>
302 </pluginRepository>
303 </pluginRepositories>
304
305 </profile>
306 </profiles>
307
308
309
310 <!-- activeProfiles
311 | List of profiles that are active for all builds.
312 -->
313 <activeProfiles>
314 <activeProfile>wessence_profile</activeProfile>
315 </activeProfiles>
316
317 </settings>

pom设置

<distributionManagement>
<repository>
<!--id 必须与settings里面的server id一致-->
<id>releases</id>
<name>corp nexus-releases</name>
<url>http://自己ip或者域名:8081/repository/wessence-releases/</url>
</repository>
<snapshotRepository>
<!--id 必须与settings里面的server id一致-->
<id>snapshots</id>
<name>corp nexus-snapshot</name>
<url>http://自己ip或者域名:8081/repository/wessence-snapshots/</url>
</snapshotRepository>
</distributionManagement>

以上文档有不对大家的请指正。

maven私服设置与使用详细的更多相关文章

  1. Maven私服(Repository Manager) - Nexus安装和使用(详细过程)

    Maven私服的安装和使用. (注:原创文章,引用请注明来自Clement-Xu的博客!) Maven私服(即Repository Manager)的主要作用: 减少从远方仓库下载的次数,节省带宽.提 ...

  2. 【Maven】3.使用IntelliJ IDEA 使用本地搭建的maven私服,而不是使用默认的maven设置

    安装Idea的教程:http://www.cnblogs.com/sxdcgaq8080/p/7641379.html 搭建maven私服的教程:http://www.cnblogs.com/sxdc ...

  3. Maven私服Nexus3.x环境构建操作记录

    Maven介绍Apache Maven是一个创新的软件项目管理和综合工具.Maven提供了一个基于项目对象模型(POM)文件的新概念来管理项目的构建,可以从一个中心资料片管理项目构建,报告和文件.Ma ...

  4. Ubuntu server下搭建Maven私服Nexus

    Ubuntu server下搭建Maven私服Nexus Maven私服Nexus的作用,主要是为了节省资源,在内部作为maven开发资源共享服务器来使用. 1.下载 通过root用户进去Ubuntu ...

  5. maven仓库总结,maven私服搭建

    配置pom.xml依赖包时在这里找包的描述: http://search.maven.org/#browse 以java为根目录. mvn archtype:generate -DgroupId=zt ...

  6. centos7搭建nexus maven私服

    前置条件: 1.安装jdk,可参考 http://www.cnblogs.com/grey-wolf/p/6480489.html 2.nexus仓库管理器,分为两个版本,Nexus Reposito ...

  7. Linux下Maven私服Nexus3.x环境构建操作记录【转】

    Maven介绍Apache Maven是一个创新的软件项目管理和综合工具.Maven提供了一个基于项目对象模型(POM)文件的新概念来管理项目的构建,可以从一个中心资料片管理项目构建,报告和文件.Ma ...

  8. 【Maven】2.使用Nexus3搭建Maven私服+上传第三方jar包到本地maven仓库

    参考文章: http://www.cnblogs.com/luotaoyeah/p/3791966.html --------------------------------------------- ...

  9. Centos7 搭建最新 Nexus3 Maven 私服

    Maven 介绍 Apache Maven 是一个创新的软件项目管理和综合工具.Maven 提供了一个基于项目对象模型(POM)文件的新概念来管理项目的构建,可以从一个中心资料片管理项目构建,报告和文 ...

  10. 使用Nexus3搭建Maven私服

    1.搭建Maven私服背景 公司还是按捺不住,要搭建一个自己的Maven本地仓库,可以让开发人员down架包,从内网还是快很多. 这样公司的maven本地仓库就是 开发人员自己电脑上的maven仓库 ...

随机推荐

  1. Angular ngx-translate 国际化实践(中文转英文)

    1.安装包 npm install @ngx-translate/core --save npm install @ngx-translate/http-loader --save 2.根模块app. ...

  2. openfoam 智能指针探索

    前言 今天看到一个程序,用到了智能指针, virtual tmp<volScalarField> rho() const; 借此机会把有关智能指针的知识体系重新梳理一遍 智能指针autoP ...

  3. 项目day1 -- vscode远程连接云服务器

    刚学完go的语法,本来想着找个小项目试试手,发现大佬们都是vscode ssh到云服务器上做开发的.正好看到阿里云的学生认证后可以白嫖,就先嫖了个试试手 跟着各大教程简单配置了一下阿里云,安装vsco ...

  4. Mybaits属性和元素

    元素有select . insert . delect . updatae属性有: restType:主要用于查找返回的结果类型 parameterTpye:主要用于增删改返回的结果类型 以下关于re ...

  5. linux中进程和线程简单介绍

    进程和线程的简单知识 进程是用来申请内核资源的,只有资源到位,进程才会进行,进程包含线程,线程是进程内部的调度单位,所以在业内有这样一句话,进程是资源分配最基本单位,线程是系统调度的最基本的单位,进程 ...

  6. 回归分析 3.X 多元线性回归

    多元线性回归模型 参数估计 模型表示 我们先将模型 \[y_{i}=\beta_{0}+\beta_{1} x_{i 1}+\cdots+\beta_{p} x_{i k}+\epsilon_{i}, ...

  7. Kittle 插入更新,时间格式错误。

    错误1:mysql转oracle 把所有时间类型格式,进行转换,不然会报时间格式错误. 错误2:插入更新时,数据量大停止了,表没有设置主键,导致的.

  8. 使用elemeng-plus控制台报错:$weight

    使用element-plus最开始按需使用,加入的组件少没有问题,但组件引入多了以后发现控制台会报下面的警告: Deprecation Warning: $weight: Passing a numb ...

  9. 将【jar包、bat、其他文件】注册到windows服务的三种方法

    将[jar包.bat.其他文件]注册到windows服务的三种方法 1.instsrv.exe和srvany.exe 1.下载配置instsrv和srvany 下载地址:https://dl.pcon ...

  10. VSCode 修改终端显示字体 字体间隔过大

    参考链接: https://code84.com/172442.html