更新 Gradle 插件后 Android maven 发布伪造错误
Andorid maven publish artifactory error after updating Gradle plugin
您好,我正在使用具有以下设置的 Android Studio:
Android工作室版-北极狐
Google 服务 - com.google.gms:google-服务:4.3.8
AGP : com.android.tools.build:gradle:7.0.4
gradle 版本:https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
我正在尝试使用以下代码在我的内部工件上发布一个工件
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'maven-publish'
id 'com.jfrog.artifactory'
}
publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/outputs/aar/abc-release.aar")
//
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
def deps = configurations.implementation.allDependencies + configurations.api.allDependencies
deps.each {
if (it.group != null && (it.name != null || "unspecified".equals(it.name)) && it.version != null && !"unspecified".equals(it.version)) {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
artifactory {
contextUrl = 'http://artifactory.local.com/artifactory'
publish {
repository {
repoKey = libraryGroupId
username = "${artifactory_user}"
password = "${artifactory_password}"
}
defaults {
publications('aar')
publishArtifacts = true
properties = ['qa.level': 'basic', 'dev.team': 'core']
publishPom = true
}
}
}
我正在尝试使用以下命令发布工件:
./gradlew :module:clean && ./gradlew :module:assembleRelease && ./gradlew :module:artifactoryPublish
它给我以下问题:
* What went wrong:
Some problems were found with the configuration of task ':module:artifactoryPublish' (type 'ArtifactoryTask').
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' field 'mavenPublications' without corresponding getter has been annotated with @Input, @Optional.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'mavenPublications'.
2. Remove the annotations on 'mavenPublications'.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' field 'publishConfigs' without corresponding getter has been annotated with @InputFiles, @Optional.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'publishConfigs'.
2. Remove the annotations on 'publishConfigs'.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' property 'deployDetails' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' property 'evaluated' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
* Try:
更新 gradle 版本后开始出现问题。在较旧的 gradle 版本上,我能够发布工件。
感谢@nilkash 建议修复。
确认将 jfrog 版本更新到 org.jfrog.buildinfo:build-info-extractor-gradle:4.28.1
解决了我的问题。
您好,我正在使用具有以下设置的 Android Studio:
Android工作室版-北极狐
Google 服务 - com.google.gms:google-服务:4.3.8
AGP : com.android.tools.build:gradle:7.0.4
gradle 版本:https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
我正在尝试使用以下代码在我的内部工件上发布一个工件
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'maven-publish'
id 'com.jfrog.artifactory'
}
publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/outputs/aar/abc-release.aar")
//
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
def deps = configurations.implementation.allDependencies + configurations.api.allDependencies
deps.each {
if (it.group != null && (it.name != null || "unspecified".equals(it.name)) && it.version != null && !"unspecified".equals(it.version)) {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
artifactory {
contextUrl = 'http://artifactory.local.com/artifactory'
publish {
repository {
repoKey = libraryGroupId
username = "${artifactory_user}"
password = "${artifactory_password}"
}
defaults {
publications('aar')
publishArtifacts = true
properties = ['qa.level': 'basic', 'dev.team': 'core']
publishPom = true
}
}
}
我正在尝试使用以下命令发布工件:
./gradlew :module:clean && ./gradlew :module:assembleRelease && ./gradlew :module:artifactoryPublish
它给我以下问题:
* What went wrong:
Some problems were found with the configuration of task ':module:artifactoryPublish' (type 'ArtifactoryTask').
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' field 'mavenPublications' without corresponding getter has been annotated with @Input, @Optional.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'mavenPublications'.
2. Remove the annotations on 'mavenPublications'.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' field 'publishConfigs' without corresponding getter has been annotated with @InputFiles, @Optional.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'publishConfigs'.
2. Remove the annotations on 'publishConfigs'.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' property 'deployDetails' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
- Type 'org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask' property 'evaluated' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
* Try:
更新 gradle 版本后开始出现问题。在较旧的 gradle 版本上,我能够发布工件。
感谢@nilkash 建议修复。
确认将 jfrog 版本更新到 org.jfrog.buildinfo:build-info-extractor-gradle:4.28.1
解决了我的问题。