仓库介绍

名称 地址 说明
maven-release http://192.168.3.122:8081/repository/maven-release/ 发布Relase版本的库
maven-snapshot http://192.168.3.122:8081/repository/maven-snapshot/ 发布snapshot版本的库
maven-center http://192.168.3.122:8081/repository/maven-center/ 代理maven中央库
maven-aliyun http://192.168.3.122:8081/repository/maven-aliyun/ 代理aliyun加速库
maven-public http://192.168.3.122:8081/repository/maven-public/ 聚合以上四个库

maven-public库聚合了maven-release,maven-snapshot,maven-center,maven-aliyun四个库 查询节点的顺序为:maven-snapshot —> maven-release—> maven-aliyun—> maven-center

私服WebAdmin

地址:http://192.168.3.122:8081/
用户名:dev-maven
密码:123456

拥有的权限:

  • 对以上maven库jar包的管理
  • 手动上传jar

    本地maven使用私服

    配置setting.xml

    1. <mirror>
    2. <id>maven-public</id>
    3. <mirrorOf>*</mirrorOf>
    4. <name>徽宁私服</name>
    5. <url>http://192.168.3.122:8081/repository/maven-public/</url>
    6. </mirror>

    配置完成后即可正常享有私服和阿里云代理的双重加速

    发布jar包到私服

    1. 配置setting.xml

    1. <server>
    2. <id>hn-maven-release</id>
    3. <username>dev-maven</username>
    4. <password>123456</password>
    5. </server>
    6. <server>
    7. <id>hn-maven-snapshot</id>
    8. <username>dev-maven</username>
    9. <password>123456</password>
    10. </server>

    2. 配置pom.xml

    1. <distributionManagement>
    2. <repository>
    3. <id>hn-maven-release</id>
    4. <name>releases</name>
    5. <url>http://192.168.3.122:8081/repository/maven-release/</url>
    6. </repository>
    7. <snapshotRepository>
    8. <id>hn-maven-snapshot</id>
    9. <name>snapshots</name>
    10. <url>http://192.168.3.122:8081/repository/maven-snapshot/</url>
    11. </snapshotRepository>
    12. </distributionManagement>

    注意 id必须要和server里的id一致

    3. 打包时将源码上传到私服

    在pom.xml中添加下添加源码插件

    1. <plugin>
    2. <groupId>org.apache.maven.plugins</groupId>
    3. <artifactId>maven-source-plugin</artifactId>
    4. <configuration>
    5. <attach>true</attach>
    6. </configuration>
    7. <executions>
    8. <execution>
    9. <phase>compile</phase>
    10. <goals>
    11. <goal>jar</goal>
    12. </goals>
    13. </execution>
    14. </executions>
    15. </plugin>