1.找到maven的安裝路徑,例如:C:\apache-maven-3.3.9
打開conf目錄下的settings.xml文件
2.在<servers>節點下,配置
<server>
<id>nexus</id>
<username>用戶名</username>
<password>密碼</password>
</server>
3.在<profiles>節點下配置
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://http://nexus_ip:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://http://nexus_ip:8081/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
4.在<settings>節點下配置
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
把本身開發的jar包上傳到Nexus服務器,在maven中便可引用java
例如:apache
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.8</version>
</dependency>