maven私服搭建

编程入门 行业动态 更新时间:2024-10-06 18:23:41

maven<a href=https://www.elefans.com/category/jswz/34/1757565.html style=私服搭建"/>

maven私服搭建

1. 安装包

window:版本
.37.3-02-win64.zip
linux:版本
.37.3-02-unix.tar.gz

2.相关脚本

<!-- 启动仓库服务 -->
bin/nexus run
<!-- 停止仓库服务,使用kill -9 命令 -->
<!-- 启动web服务-->
bin/nexus start
<!-- 停止web服务-->
bin/nexus stop<!-- 访问程序网址: http://ip:端口(默认8081)/nextus(配置文件中配置,参照下图) -->
http://192.168.236.69:8081/nexus/
默认用户名:admin
密码:根据登录页面提示的文件中查找

创建仓库:

参照网页:

创建用户:在maven配置文件中配置的是用户id和密码

创建角色:

maven配置:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns=".0.0"xmlns:xsi=""xsi:schemaLocation=".0.0 .0.0.xsd"><localRepository>D:/myMaven/mavenSF</localRepository><servers><server><id>xwk-releases</id><username>deployment</username><password>deployment</password></server><server><id>xwk-snapshot</id><username>deployment</username><password>deployment</password></server></servers><mirrors><mirror><id>alimaven</id><name>aliyun maven</name><url>/</url><mirrorOf>central</mirrorOf>        </mirror><mirror><id>nexus</id><mirrorOf>*,!jeecg,!jeecg-snapshots</mirrorOf><name>nexus repository</name><url>http://192.168.236.60:8081/nexus/repository/shenxi-public/</url></mirror></mirrors><profiles><profile><id>nexus</id><repositories><repository><id>nexus</id><url>http://192.168.236.60:8081/nexus/repository/shenxi-public/</url><releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases><snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>nexus</id><url>http://192.168.236.60:8081/nexus/repository/shenxi-public/</url><releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases><snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots></pluginRepository></pluginRepositories></profile></profiles><activeProfiles><activeProfile>nexus</activeProfile></activeProfiles>
</settings>

pom配置:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=".0.0"xmlns:xsi=""xsi:schemaLocation=".0.0 .0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>test-mav</artifactId><version>1.0-RELEASE</version><dependencies><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.2.79</version></dependency></dependencies><!-- 发布 --><pluginRepositories><pluginRepository><releases><updatePolicy>always</updatePolicy></releases><snapshots><enabled>false</enabled></snapshots><id>nexus</id><url>http://192.168.236.60:8081/nexus/repository/shenxi-public/</url></pluginRepository></pluginRepositories><distributionManagement><repository><!-- id一定要和maven setting中的配置一样 --><id>shenxi-releases</id><url>http://192.168.236.60:8081/nexus/repository/xwk-hosted/</url></repository><snapshotRepository><id>shenxi-snapshot</id><url>http://192.168.236.60:8081/nexus/repository/xwk-hosted/</url></snapshotRepository></distributionManagement>
</project>

单个上传包:

批量上传:

<!--参照此网页:-->

#!/bin/bash
# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important
# Get command line params
while getopts ":r:u:p:" opt; docase $opt inr) REPO_URL="$OPTARG";;u) USERNAME="$OPTARG";;p) PASSWORD="$OPTARG";;esac
donefind . -type f -not -path './mavenimport\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml' -not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;
./mavenimport.sh -u admin -p tmkj@zgb123 -r http://192.168.236.60:8081/nexus/repository/xwk-hosted

更多推荐

maven私服搭建

本文发布于:2024-02-14 02:03:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1761480.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:私服   maven

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!