1. 在要发布到maven私服的项目pom.xml加入下面配置
<
distributionManagement
>
<
repository
>
<
id
>huwo-local-releases</
id
>
<
name
>local-releases</
name
>
</
repository
>
<
snapshotRepository
>
<
id
>huwo-local-snapshots</
id
>
<
name
>local snapshots</
name
>
</
snapshotRepository
>
</
distributionManagement
>
当项目版本号后面带 -SNAPSHOT 的时候,会发布到 libs-snapshot-local 库,如果不带,会发布到 libs-release-local 库
2. 本地settings.xml文件加入server相关帐号密码配置
<
servers
>
<
server
>
<
id
>huwo-local-releases</
id
>
<
username
>release</
username
>
<
password
>xxxxxx</
password
>
</
server
>
<
server
>
<
id
>huwo-local-snapshots</
id
>
<
username
>release</
username
>
<
password
>xxxxxxx</
password
>
</
server
>
</
servers
>
使用私有库组件配置
在项目的pom.xml文件中加入下面配置
<
repositories
>
<
repository
>
<
id
>huwo-local-releases</
id
>
<
name
>Local repository</
name
>
<
releases
><
enabled
>true</
enabled
></
releases
>
<
snapshots
>
<
enabled
>false</
enabled
>
</
snapshots
>
</
repository
>
<
repository
>
<
id
>huwo-local-snapshot</
id
>
<
name
>Local repository</
name
>
<
snapshots
>
<
enabled
>true</
enabled
>
</
snapshots
>
</
repository
>
</
repositories
>
maven会根据不同的依赖组件版本到不同库中下载组件