nexus warehouse type
There are four types of warehouses:
- group: warehouse group
- hosted: host
- proxy: proxy
- virtual: virtual
Warehouse group
For external use, directly use the warehouse group for external use.
Such as: http: // [private service IP]: 8082 / nexus / content / groups / public /
Pay attention to the order of the warehouse group, generally the company first, then the third party, then the central warehouse.
- Releases: The host type repository used to deploy and manage the release version components within the company
- Snapshots: Host type repository used to deploy and manage snapshot version components within the company
- 3rd party: A third-party release version of the component warehouse that cannot be obtained from the public warehouse (SMS SDK, etc.)
- Central: the warehouse used to proxy the release version components in the maven central warehouse
Best use:
Settings.xml configuration under .m2
<?xml version="1.0" encoding="UTF-8"?>
<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>/Users/jeikerxiao/.m2/repository</localRepository>
<servers>
<!-- 私服仓库账号和密码,用于部署使用 -->
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<!-- 所有请求远程仓库都走私服 -->
<mirrors>
<mirror>
<id>nexus-releases</id>
<mirrorOf>*</mirrorOf>
<url>http://[私服IP]:8082/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>nexus-snapshots</id>
<mirrorOf>*</mirrorOf>
<url>http://[私服IP]:8082/nexus/content/repositories/snapshots</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus-releases</id>
<url>http://nexus-releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>nexus-snapshots</id>
<url>http://nexus-snapshots</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus-releases</id>
<url>http://nexus-releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>nexus-snapshots</id>
<url>http://nexus-snapshots</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
Pom.xml configuration of maven project
<distributionManagement>
<!-- 两个ID必须与 setting.xml中的<server><id>nexus-releases</id></server>保持一致-->
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://[私服IP]:8082/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://[私服IP]:8082/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>