我想签名并上传到由proguard处理的maven repo jar文件。整个管道工作正常,但现在我想签名并上传jar任务创建的jar文件,而不是proguard创建的jar文件。
我build.gradle
的相关部分:
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
group = 'com.mycompany'
version = '1.0.0'
// no explicit jar declaration
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: 'jar') {
injars "$buildDir/libs/${jar.baseName}-${version}.jar"
//WHAT'S NEEDED TO CHANGE IT TO: ${jar.baseName}-${version}-original.jar
outjars "$buildDir/libs/${jar.baseName}-${version}-processed.jar"
// WHAT'S NEEDED TO CHANGE IT TO: ${jar.baseName}-${version}.jar
...
}
artifacts {
archives jar, javadocJar // HOW TO ADD PROGUARD OUTPUT HERE?
}
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment ->
signing.signPom(deployment) }
...
}
我知道我可以在proguard任务之前简单地替换文件名,但这样我就会失去增量构建:当原始jar重命名并且proguard任务失败时,下一次构建将不再需要再次创建jar
答案 0 :(得分:0)
def obfsJar =
artifacts.add(
'archives', file(proguard.outputs.files.singleFile)) {
type('jar')
builtBy(proGuardTask)
}
publishing {
publications {
artifactoryPublications(MavenPublication) {
artifact obfsJar
}
}
}