前提环境:nexus
settings文件
<?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>E:\repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>1234</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<name>nexus repository</name>
<url>http://192.168.1.48:8081/repository/group_repo/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</settings>
pom.xml配置
这里repository的id要与settings文件一样,这里的url配置的远程仓库类型要是hosted类型的
<!--发布配置管理-->
<distributionManagement>
<repository>
<id>nexus</id>
<url>http://192.168.1.48:8081/repository/hosted_repo/</url>
</repository>
</distributionManagement>
上传组件
点击deploy
上传成功后,nexus远程仓库hosted_repo也能看到