Mac环境搭建私有maven库

Posted by Edward on September 24, 2021
  1. 安装Nexus
    brew install nexus
    
  2. 开启Nexus服务
    brew services start nexus 
    
  3. 启动Nexus
    nexus run
    
  4. 配置 ~/.m2/settings.xml ``` <?xml version=”1.0” encoding=”UTF-8”?>
${user.home}/.m2/repository nexus admin admin123 releases admin admin123 snapshots admin admin123 nexus snapshots,releases http://localhost:8081/repository/maven-public/ mirror central,jcenter,!rdc-releases,!rdc-snapshots mirror https://maven.aliyun.com/nexus/content/groups/public nexus nexus http://localhost:8081/repository/maven-public/ false always false always releases Nexus Release Repository http://localhost:8081/repository/maven-releases true always snapshots Nexus Snapshot Repository http://localhost:8081/repository/maven-snapshots true always nexus-plugin http://localhost:8081/repository/maven-public true always true always jdk1.8 true 1.8 1.8 1.8 1.8 3.1.1 nexus jdk1.8 nexus true http 127.0.0.1 8081

5. 刷新配置

//查看当前生效的配置,执行后会自动拉取一些库 mvn help:effective-settings

//指定settings文件 mvn install –settings ~/.m2/settings.xml


6. mvn 命令上传

file=test-release.aar repo_url=”http://192.168.your.ip:8081/repository/maven-releases/”

mvn deploy:deploy-file
-DgroupId=”com.test.xxx”
-DartifactId=”test”
-Dversion=”1.0.0”
-Dpackaging=”aar”
-Dfile=$file
-Durl=$repo_url
-DrepositoryId=”releases”

```