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中即可引用
例如:
<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.9.8</version> </dependency>
时间: 2024-10-13 10:44:27