当前位置:   article > 正文

Maven上传jar到私仓_maven批量上传jar到私仓

maven批量上传jar到私仓

1. 创建Maven仓库

2. 查看Maven仓库信息

获取usernamepasswordreleaseRepositoryUrlsnapshotRepositoryUrl信息

3. 配置本地settings.xml文件

将下面的xml内容复制替换到本地的settings.xml文件中,在替换之前记得保存自己本地的setting.xml的副本。

修改xml中的usernamepasswordreleaseRepositoryUrlsnapshotRepositoryUrl为第二步中的内容

<?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">

    <mirrors>
        <mirror>
            <id>mirror</id>
            <name>mirror</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
            <mirrorOf>*,!dayu-maven-releases,!dayu-maven-snapshots,!maven-dayu-common</mirrorOf>
        </mirror>
    </mirrors>

    <servers>
        <server>
            <id>dayu-common</id>
            <username>maven-dayu-common-reader</username>
            <password>stVr5LAX4ZlOPMjf</password>
        </server>
        <server>
            <id>dayu-maven-snapshots</id>
            <username>username</username>
            <password>password</password>
        </server>
        <server>
            <id>dayu-maven-releases</id>
            <username>username</username>
            <password>password</password>
        </server>
    </servers>

    <profiles>

        <profile>
            <id>maven-dayu-common</id>
            <repositories>
                <repository>
                    <id>maven-dayu-common</id>
                    <url>https://nexus.dayu.work/repository/maven-dayu-common</url>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>maven-dayu-common</id>
                    <url>https://nexus.dayu.work/repository/maven-dayu-common</url>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                </pluginRepository>
            </pluginRepositories>
        </profile>

        <profile>
            <id>dayu-project</id>
            <repositories>
                <repository>
                    <id>dayu-maven-releases</id>
                    <url>releaseRepositoryUrl</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>dayu-maven-snapshots</id>
                    <url>snapshotRepositoryUrl</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>dayu-maven-releases</id>
                    <url>releaseRepositoryUrl</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </pluginRepository>
                <pluginRepository>
                    <id>dayu-maven-snapshots</id>
                    <url>snapshotRepositoryUrl</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>

    </profiles>

    <activeProfiles>
        <activeProfile>maven-dayu-common</activeProfile>
        <activeProfile>dayu-project</activeProfile>
    </activeProfiles>
</settings>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115

4. 上传jar包或pom文件到私有Maven仓库中

  • 执行mvn package打出来要上传的jar包
  • 通过maven deploy:deploy-file上传jar包
    示例
    snapshot包:(版本以SNAPSHOT结尾的传到此仓库)
mvn deploy:deploy-file -DgroupId=org.vaadin.addons -DartifactId=dcharts-widget -Dversion=0.10.0 -Dpackaging=jar -Dfile=dcharts-widget-SNAPSHOT-0.10.0.jar -DpomFile=dcharts-widget-SNAPSHOT-0.10.0.pom -DgeneratePom=false -Durl=https://nexus.dayu.work/repository/bp[替换为项目ID]-snapshots -DrepositoryId=dayu-maven-snapshots
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/48431
推荐阅读
相关标签
  

闽ICP备14008679号