settings.xml 中配置
1,jar包将优先从此配置仓库下载
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://,localhost/repository/maven-public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://localhost/repository/maven-public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
2,
<server>
<id>base-snapshot</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>base-release</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>base-3rdPart</id>
<username>deployment</username>
<password>deployment123</password>
</server>
3,jar包将强制从此镜像下载
<mirror>
<id>longen</id>
<name>longen</name>
<url>http://localhost/repository/maven-public/</url>
<mirrorOf>*</mirrorOf>
</mirror>
4,上传nexus第三方jar,for example :jd。sdk
mvn deploy:deploy-file -DgroupId=com.jd.open.api -DartifactId=open-api-sdk -Dversion=2.0 -Dpackaging=jar -Dfile=D:\jd-sdk-2.0.jar -Durl=http://localhost/repository/3rd_part/ -DrepositoryId=base-3rdPart
5,maven 打jar命令
mvn clean package -Dmaven.test.skip=true