JJD*_*JJD 7 nexus sonatype gradle maven-plugin
我正在使用Gradle maven 插件将构建工件推送到正在运行的Sonatype Nexus机器Nexus Repository Manager OSS 2.14.15-01
。
部署配置如下:
repositories {
mavenDeployer {
if (credentials.user == "deployment.fancy") {
pom.version = project.fancy.defaultConfig.versionName
repository(url: "https://example.com/nexus/content/repositories/com.example.release") {
authentication(userName: credentials.user, password: credentials.password)
}
} else {
pom.version = project.fancy.defaultConfig.versionName + "-SNAPSHOT"
repository(url: "https://example.com/nexus/content/repositories/com.example.snapshot") {
authentication(userName: credentials.user, password: credentials.password)
}
}
pom.artifactId = "${project.artifactId}"
pom.groupId = "com.example.libs"
pom.project {
description "Revision ${getVersionCode(project)}"
organization {
name 'Example Inc.'
url 'https://www.example.com'
}
scm {
tag "${getVersionCode(project)}"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我上传工件时,它已成功存储在相应的文件夹中。我可以将其依赖项添加到项目中并使用它。
当我使用Gradle Versions 插件检查工件的新版本时,它不会自动检测到有新版本。我看了一下maven-metadata.xml文件,发现它已经过时了:
<metadata modelVersion="1.1.0">
<groupId>com.exanoke.fancy.gradle</groupId>
<artifactId>exanoke-fancy</artifactId>
<versioning>
<latest>0.6.0</latest>
<release>0.6.0</release>
<versions>
<version>0.1.0</version>
<version>0.2.0</version>
<version>0.2.1</version>
<version>0.2.2</version>
<version>0.3.0</version>
<version>0.3.1</version>
<version>0.4.0</version>
<version>0.5.0</version>
<version>0.6.0</version>
</versions>
<lastUpdated>20191119124423</lastUpdated>
</versioning>
</metadata>
Run Code Online (Sandbox Code Playgroud)
在示例中,0.7.0 和 0.8.0 版本已经可用。
我可以通过调用文件夹树上的“重建索引”来更新文件,如Nexus 文档中所述。
我该怎么做才能在每次发布新工件时自动重建索引?
以下插件应用于项目:
plugins {
`java-gradle-plugin`
`maven-publish`
}
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "com.github.ben-manes.versions")
apply(plugin = "maven")
Run Code Online (Sandbox Code Playgroud) 归档时间: |
|
查看次数: |
1179 次 |
最近记录: |