Nexus源替换及Gitlab迁移

Maven镜像替换

一、替换settings文件

注意:localRepository需替换为本机仓库地址

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?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.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: ~/.m2/repository

-->
<localRepository>~/.m2/repository</localRepository>

<pluginGroups>
<pluginGroup>org.sonatype.plugins</pluginGroup>
</pluginGroups>

<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>administrator</password>
</server>
<server>
<id>releases</id>
<username>admin</username>
<password>administrator</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>administrator</password>
</server>
</servers>

<profiles>
<profile>
<id>nexus</id>
<repositories>

<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://172.16.140.153:9003/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>

<repository>
<id>releases</id>
<name>Nexus Releases</name>
<url>http://172.16.140.153:9003/repository/maven-releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>

<repository>
<id>snapshots</id>
<name>Nexus Snapshots</name>
<url>http://172.16.140.153:9003/repository/maven-snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>

</repositories>

<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://172.16.140.153:9003/repository/maven-public/</url>
</pluginRepository>

<pluginRepository>
<id>releases</id>
<url>http://172.16.140.153:9003/repository/maven-releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>

<pluginRepository>
<id>snapshots</id>
<url>http://172.16.140.153:9003/repository/maven-snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>

</pluginRepositories>
</profile>
</profiles>

<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>

NPM 源替换

一、使用153私服镜像

1.临时使用

npm --registry http://172.16.140.153:9003/repository/npm-nexus install express

2.长久使用

npm config set registry http://172.16.140.153:9003/repository/npm-nexus

3.通过cnpm

npm install -g cnpm --registry=http://172.16.140.153:9003/repository/npm-nexus

二、恢复官方镜像

npm config set registry https://registry.npmjs.org/

三、查看npm源地址

npm config get registry

Gitlab迁移

  • 通过邮箱查看密码重置链接,登录后添加SSH key,头像>>Settings>>SSH Keys
  • 修改本地已有项目的gitlab地址,cd到项目下,执行:
    如:git remote set-url origin ssh://git@172.16.140.153:10022/rs/remoteservice-new.git