|
89 | 89 | </mirrors>
|
90 | 90 | ```
|
91 | 91 |
|
| 92 | +## 本地开发的 jar 发布到 Nexus 上 |
| 93 | + |
| 94 | +- 系统下的 settings.xml 下改为如下: |
| 95 | + |
| 96 | +``` xml |
| 97 | +<?xml version="1.0" encoding="UTF-8"?> |
| 98 | + |
| 99 | +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" |
| 100 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 101 | + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> |
| 102 | + |
| 103 | + |
| 104 | + <localRepository>D:\maven\my_local_repository</localRepository> |
| 105 | + |
| 106 | + <pluginGroups> |
| 107 | + </pluginGroups> |
| 108 | + |
| 109 | + <proxies> |
| 110 | + </proxies> |
| 111 | + |
| 112 | + |
| 113 | + <!--设置 Nexus 认证信息--> |
| 114 | + <servers> |
| 115 | + <server> |
| 116 | + <id>nexus-releases</id> |
| 117 | + <username>admin</username> |
| 118 | + <password>admin123</password> |
| 119 | + </server> |
| 120 | + <server> |
| 121 | + <id>nexus-snapshots</id> |
| 122 | + <username>admin</username> |
| 123 | + <password>admin123</password> |
| 124 | + </server> |
| 125 | + </servers> |
| 126 | + |
| 127 | + |
| 128 | + <!--设置 Nexus 镜像,后面只要本地没对应的以来,则到 Nexus 去找--> |
| 129 | + <mirrors> |
| 130 | + <mirror> |
| 131 | + <id>nexus-releases</id> |
| 132 | + <mirrorOf>*</mirrorOf> |
| 133 | + <url>http://192.168.1.73:8081/repository/maven-releases/</url> |
| 134 | + </mirror> |
| 135 | + <mirror> |
| 136 | + <id>nexus-snapshots</id> |
| 137 | + <mirrorOf>*</mirrorOf> |
| 138 | + <url>http://192.168.1.73:8081/repository/maven-snapshots/</url> |
| 139 | + </mirror> |
| 140 | + <mirror> |
| 141 | + <id>aliyun-maven</id> |
| 142 | + <name>aliyun maven</name> |
| 143 | + <url>http://maven.aliyun.com/nexus/content/groups/public/</url> |
| 144 | + <mirrorOf>central</mirrorOf> |
| 145 | + </mirror> |
| 146 | + </mirrors> |
| 147 | + |
| 148 | + <profiles> |
| 149 | + <profile> |
| 150 | + <id>nexus</id> |
| 151 | + <repositories> |
| 152 | + <repository> |
| 153 | + <id>nexus-releases</id> |
| 154 | + <url>http://nexus-releases</url> |
| 155 | + <releases> |
| 156 | + <enabled>true</enabled> |
| 157 | + </releases> |
| 158 | + <snapshots> |
| 159 | + <enabled>true</enabled> |
| 160 | + </snapshots> |
| 161 | + </repository> |
| 162 | + <repository> |
| 163 | + <id>nexus-snapshots</id> |
| 164 | + <url>http://nexus-snapshots</url> |
| 165 | + <releases> |
| 166 | + <enabled>true</enabled> |
| 167 | + </releases> |
| 168 | + <snapshots> |
| 169 | + <enabled>true</enabled> |
| 170 | + </snapshots> |
| 171 | + </repository> |
| 172 | + </repositories> |
| 173 | + <pluginRepositories> |
| 174 | + <pluginRepository> |
| 175 | + <id>nexus-releases</id> |
| 176 | + <url>http://nexus-releases</url> |
| 177 | + <releases> |
| 178 | + <enabled>true</enabled> |
| 179 | + </releases> |
| 180 | + <snapshots> |
| 181 | + <enabled>true</enabled> |
| 182 | + </snapshots> |
| 183 | + </pluginRepository> |
| 184 | + <pluginRepository> |
| 185 | + <id>nexus-snapshots</id> |
| 186 | + <url>http://nexus-snapshots</url> |
| 187 | + <releases> |
| 188 | + <enabled>true</enabled> |
| 189 | + </releases> |
| 190 | + <snapshots> |
| 191 | + <enabled>true</enabled> |
| 192 | + </snapshots> |
| 193 | + </pluginRepository> |
| 194 | + </pluginRepositories> |
| 195 | + </profile> |
| 196 | + </profiles> |
| 197 | + |
| 198 | + <activeProfiles> |
| 199 | + <activeProfile>nexus</activeProfile> |
| 200 | + </activeProfiles> |
| 201 | + |
| 202 | +</settings> |
| 203 | +``` |
| 204 | + |
| 205 | +- 在开发的项目 pom.xml 上,添加这一段: |
| 206 | + |
| 207 | +``` xml |
| 208 | +<distributionManagement> |
| 209 | + <repository> |
| 210 | + <id>nexus-releases</id> |
| 211 | + <url>http://192.168.1.73:8081/repository/maven-releases/</url> |
| 212 | + </repository> |
| 213 | + <snapshotRepository> |
| 214 | + <id>nexus-snapshots</id> |
| 215 | + <url>http://192.168.1.73:8081/repository/maven-snapshots/</url> |
| 216 | + </snapshotRepository> |
| 217 | +</distributionManagement> |
| 218 | +``` |
| 219 | + |
| 220 | + |
92 | 221 |
|
93 | 222 | ## 持续集成自动构建后发布到 Nexus 上
|
94 | 223 |
|
|
0 commit comments