美文网首页
Nexus私服配置

Nexus私服配置

作者: 梅西爱骑车 | 来源:发表于2020-11-16 18:17 被阅读0次

    maven的settings文件settings-deep.xml

    <?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 | The path to the local repository maven will use to
                store artifacts. | | Default: ~/.m2/repository <localRepository>D:/Maven/repo</localRepository> -->
        <localRepository>D:\dev\mvnRespo</localRepository>
        <pluginGroups>
            <!-- pluginGroup | Specifies a further group identifier to use for plugin
                    lookup. <pluginGroup>com.your.plugins</pluginGroup> -->
        </pluginGroups>
    
    
        <!-- 增加私服Nexus进行自有项目deploy到私服的认证,        <id>public-nexus-npay</id>对应POM中的id -->
        <server>
            <id>public-nexus-npay</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server>
            <id>snapshot-npay</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        
    
        <profiles>
            <profile>
                <id>npay-profile</id>
                <properties></properties>
                <repositories>
                    <repository>
                        <id>deepxin-repos</id>
                        <url>https://maven.deepxin.com/nexus/content/groups/public/</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </repository>
                    <repository>
                        <id>aliyun-repos</id>
                        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </repository>
                    <repository>
                        <id>io.spring.repo.maven.release</id>
                        <url>http://repo.spring.io/release/</url>
                        <releases>
                            <enabled>true</enabled>
                            <updatePolicy>always</updatePolicy>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </repository>
                </repositories>
                <pluginRepositories>
                    <pluginRepository>
                        <id>deepxin-plugin</id>
                        <url>https://maven.deepxin.com/nexus/content/groups/public/</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </pluginRepository>
                    <pluginRepository>
                        <id>aliyun-plugin</id>
                        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                    </pluginRepository>
                </pluginRepositories>
            </profile>
        </profiles>
        <activeProfiles>
            <activeProfile>npay-profile</activeProfile>
        </activeProfiles>
    </settings>
    
    

    NPay私服nexus打包:
    mvn install clean -Dmaven.test.skip=true --settings /root/jenkins/maven/conf/settings-deep.xml

    如果想把本地工程也deploy到nexus,需要在pom中添加:

        <distributionManagement>
            <repository>
                <id>public-nexus-npay</id>
                <url>https://maven.deeeeep.com/nexus/content/groups/public/</url>
                <name>nexus私服中宿主仓库->存放/下载稳定版本的构件</name>
            </repository>
            <snapshotRepository>
                <id>snapshot-npay</id>
                <url>https://maven.deeeeep.com/repository/maven-snapshots/</url>
                <name>nexus私服中宿主仓库->存放/下载快照版本的构件</name>
            </snapshotRepository>
        </distributionManagement>
    

    https://www.jianshu.com/p/f03ef218466c

    相关文章

      网友评论

          本文标题:Nexus私服配置

          本文链接:https://www.haomeiwen.com/subject/nwyzbktx.html