gradle上传jar到nexus私服
-
下载解压nexus
-
启动
nexus.exe /run nexus
- 浏览器访问
http://localhost:8081/
- 构建1个gardle项目
gradle init
- build.gradle中配置如下
plugins {
id 'java'
id 'maven-publish' // 用于发布
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'com.ychen.demo'
artifactId = 'demo'
version = '1.1-SNAPSHOT'
from components.java
}
}
repositories {
maven {
allowInsecureProtocol = true
url "http://localhost:8081/repository/maven-snapshots/"
credentials {
username 'admin'
password 'admin'
}
}
}
}
-
上传
-
查看
-
报错:
Failed to publish publication ‘maven‘ to repository ‘maven3‘ > Using insecure protocols with repo
# 解决方案
allowInsecureProtocol = true
- 报错:
Maven Failed to deploy artifacts: status: 405 PUT
# 解决方案
使用hosted类型的仓库
-
上传到远程nexus私服:只需将url修改为远程的地址即可
-
查看