Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publication variant not found on newest version #132

Open
TomTruyen opened this issue Dec 2, 2024 · 0 comments
Open

Publication variant not found on newest version #132

TomTruyen opened this issue Dec 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@TomTruyen
Copy link

Describe the bug

Prior to upgrading to the latest version of the plugin, publications were working just fine. However when trying to upgrade the error occurs during publication:

* What went wrong:
Execution failed for task ':ba:generateMetadataFileForAarPublication'.
> Invalid publication 'aar':
    - This publication must publish at least one variant

The setup works perfectly find on 5.1.10. We use KTS with Gradle 8.9 and Java 17 in a multi-module Android library project with the following Artifactory configuration:

subprojects {
    apply {
        plugin("maven-publish")
        plugin("com.jfrog.artifactory")
    }

    // Artifactory Configuration
    afterEvaluate {
        configure<ArtifactoryPluginConvention> {
            publish {
                contextUrl = "[REDACTED]"

                repository {
                    repoKey = "[REDACTED]"

                    username = "[REDACTED]"
                    password = "[REDACTED]"
                }

                defaults {
                    publications("aar")

                    setPublishArtifacts(true)
                    setPublishPom(true)
                }
            }
        }

        // Configuration for the `aar` Maven Artifacts
        afterEvaluate {
            if (!plugins.hasPlugin("android")) {
                publishing {
                    publications {
                        create<MavenPublication>("aar") {
                            version = "1.0.0"
                            artifactId = "${rootProject.name}-${project.name}"

                            if (plugins.hasPlugin("android-library")) {
                                from(components["release"])

                                pom {
                                    name.set("[REDACTED]")
                                    description.set("[REDACTED]")

                                    licenses {
                                        license {
                                            name = "[REDACTED]"
                                            url = "[REDACTED]"
                                        }
                                    }

                                    developers {
                                        developer {
                                            name = "[REDACTED]"
                                            email = "[REDACTED]"
                                        }
                                    }

                                    scm {
                                        connection = "scm:[email protected]:[REDACTED]"
                                        developerConnection = "scm:[email protected]:[REDACTED]"
                                        url = "https://bitbucket.org/[REDACTED]"
                                    }
                                }
                            }
                        }
                    }
                }

                with(tasks) {
                    named<ArtifactoryTask>("artifactoryPublish") {
                        dependsOn("assembleRelease")
                        publications(publishing.publications.getByName("aar"))
                    }

                    register("uploadSdk") {
                        group = "publishing"
                        description = "Uploads all submodules to Artifactory."

                        shouldRunAfter("assembleRelease")

                        // Clean, build and generate the POM file for the AAR publication
                        dependsOn(
                            "generatePomFileForAarPublication",
                            "publishAarPublicationToMavenLocal",
                            "artifactoryPublish"
                        )

                        doLast {
                            println("Uploading: ${project.name} to Artifactory complete!")
                        }
                    }
                }
            }
        }
    }
}

I have redacted some credentials/personal information. I can ensure however that those are filled in while running the publication.

Current behavior

Publication fails due to:

> Invalid publication 'aar':
    - This publication must publish at least one variant

even though it is defined.

Full log:


Welcome to Gradle 8.9!
Here are the highlights of this release:
 - Enhanced Error and Warning Messages
 - IDE Integration Improvements
 - Daemon JVM Information
For more details see https://docs.gradle.org/8.9/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
~/.gradle/init.gradle was found and loaded.
~/.gradle/init.gradle was found and loaded.
> Task :buildSrc:checkKotlinGradlePluginConfigurationErrors
> Task :buildSrc:compileKotlin NO-SOURCE
> Task :buildSrc:compileJava NO-SOURCE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:pluginDescriptors
> Task :buildSrc:processResources NO-SOURCE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:jar
:jar: No valid plugin descriptors were found in META-INF/gradle-plugins
> Configure project :
w: file:///Users/vagrant/git/android/build.gradle.kts:111:107: Unchecked cast: Any! to Map<String, String>
> Configure project :ba
w: file:///Users/vagrant/git/android/ba/build.gradle.kts:19:87: Unchecked cast: Any! to Map<String, String>
> Configure project :demo
WARNING: BuildType 'release' is both debuggable and has 'isMinifyEnabled' set to true.
All code optimizations and obfuscation are disabled for debuggable builds.
> Configure project :templatepreviewer
WARNING: BuildType 'release' is both debuggable and has 'isMinifyEnabled' set to true.
All code optimizations and obfuscation are disabled for debuggable builds.
None of the specified publications matched for project ':templatepreviewer' - nothing to publish.
None of the specified publications matched for project ':demo' - nothing to publish.
Errors during XML parse:
Additionally, the fallback loader failed to parse the XML.
Checking the license for package Android SDK Build-Tools 34 in /usr/local/share/android-sdk/licenses
License for package Android SDK Build-Tools 34 accepted.
Preparing "Install Android SDK Build-Tools 34 v.34.0.0".
"Install Android SDK Build-Tools 34 v.34.0.0" ready.
Installing Android SDK Build-Tools 34 in /usr/local/share/android-sdk/build-tools/34.0.0
"Install Android SDK Build-Tools 34 v.34.0.0" complete.
"Install Android SDK Build-Tools 34 v.34.0.0" finished.
Checking the license for package Android SDK Platform 35 in /usr/local/share/android-sdk/licenses
License for package Android SDK Platform 35 accepted.
Preparing "Install Android SDK Platform 35 (revision 1)".
"Install Android SDK Platform 35 (revision 1)" ready.
Installing Android SDK Platform 35 in /usr/local/share/android-sdk/platforms/android-35
"Install Android SDK Platform 35 (revision 1)" complete.
"Install Android SDK Platform 35 (revision 1)" finished.
> Task :ba:preBuild UP-TO-DATE
> Task :ba:preReleaseBuild UP-TO-DATE
> Task :ba:mergeReleaseJniLibFolders
> Task :ba:mergeReleaseNativeLibs NO-SOURCE
> Task :ba:stripReleaseDebugSymbols NO-SOURCE
> Task :ba:generateReleaseResValues
> Task :ba:copyReleaseJniLibsProjectAndLocalJars
> Task :ba:extractDeepLinksForAarRelease
> Task :ba:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :ba:generateReleaseBuildConfig
> Task :ba:generateReleaseResources
> Task :ba:packageReleaseResources
> Task :base:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :base:preBuild UP-TO-DATE
> Task :base:preReleaseBuild UP-TO-DATE
> Task :ba:parseReleaseLocalResources
> Task :base:dataBindingMergeDependencyArtifactsRelease
> Task :base:generateReleaseResValues
> Task :base:generateReleaseResources
> Task :ba:generateReleaseRFile
> Task :base:packageReleaseResources
> Task :base:generateReleaseBuildConfig
> Task :d:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :d:preBuild UP-TO-DATE
> Task :d:preReleaseBuild UP-TO-DATE
> Task :base:parseReleaseLocalResources
> Task :base:javaPreCompileRelease
> Task :d:generateReleaseResValues
> Task :base:dataBindingGenBaseClassesRelease
> Task :d:generateReleaseResources
> Task :base:generateReleaseRFile
> Task :d:packageReleaseResources
> Task :hb:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :hb:preBuild UP-TO-DATE
> Task :hb:preReleaseBuild UP-TO-DATE
> Task :d:parseReleaseLocalResources
> Task :hb:generateReleaseResValues
> Task :d:generateReleaseRFile
> Task :hb:generateReleaseResources
> Task :hb:packageReleaseResources
> Task :hb:parseReleaseLocalResources
> Task :hb:javaPreCompileRelease
> Task :d:javaPreCompileRelease
> Task :lf:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :lf:preBuild UP-TO-DATE
> Task :lf:preReleaseBuild UP-TO-DATE
> Task :hb:generateReleaseRFile
> Task :base:compileReleaseKotlin
> Task :lf:dataBindingMergeDependencyArtifactsRelease
> Task :base:compileReleaseJavaWithJavac
> Task :lf:generateReleaseResValues
> Task :lf:generateReleaseResources
> Task :lf:packageReleaseResources
> Task :lf:parseReleaseLocalResources
> Task :o:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :lf:javaPreCompileRelease
> Task :base:bundleLibCompileToJarRelease
> Task :lf:dataBindingGenBaseClassesRelease
> Task :o:preBuild UP-TO-DATE
> Task :o:preReleaseBuild UP-TO-DATE
> Task :lf:generateReleaseRFile
> Task :o:generateReleaseResValues
> Task :hb:compileReleaseKotlin
> Task :hb:compileReleaseJavaWithJavac NO-SOURCE
> Task :hb:bundleLibCompileToJarRelease
> Task :o:generateReleaseResources
> Task :o:packageReleaseResources
> Task :t:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :t:preBuild UP-TO-DATE
> Task :t:preReleaseBuild UP-TO-DATE
> Task :o:javaPreCompileRelease
> Task :o:parseReleaseLocalResources
> Task :t:generateReleaseBuildConfig
> Task :t:generateReleaseResValues
> Task :o:generateReleaseRFile
> Task :t:generateReleaseResources
> Task :lf:compileReleaseKotlin
> Task :d:compileReleaseKotlin
> Task :d:compileReleaseJavaWithJavac NO-SOURCE
> Task :lf:compileReleaseJavaWithJavac NO-SOURCE
> Task :d:bundleLibCompileToJarRelease
> Task :lf:bundleLibCompileToJarRelease
> Task :t:packageReleaseResources
> Task :video:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :t:parseReleaseLocalResources
> Task :video:preBuild UP-TO-DATE
> Task :t:javaPreCompileRelease
> Task :video:preReleaseBuild UP-TO-DATE
> Task :t:generateReleaseRFile
> Task :o:compileReleaseKotlin
> Task :video:dataBindingMergeDependencyArtifactsRelease
> Task :o:compileReleaseJavaWithJavac
> Task :o:bundleLibCompileToJarRelease
> Task :video:generateReleaseResValues
> Task :video:generateReleaseResources
> Task :video:packageReleaseResources
> Task :video:javaPreCompileRelease
> Task :x:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :x:preBuild UP-TO-DATE
> Task :x:preReleaseBuild UP-TO-DATE
> Task :video:parseReleaseLocalResources
> Task :t:compileReleaseKotlin
> Task :x:dataBindingMergeDependencyArtifactsRelease
> Task :t:compileReleaseJavaWithJavac
> Task :t:bundleLibCompileToJarRelease
> Task :video:dataBindingGenBaseClassesRelease
> Task :x:generateReleaseResValues
> Task :video:generateReleaseRFile
> Task :x:generateReleaseResources
> Task :x:packageReleaseResources
> Task :x:javaPreCompileRelease
> Task :ba:javaPreCompileRelease
> Task :x:parseReleaseLocalResources
> Task :ba:mergeReleaseShaders
> Task :x:dataBindingGenBaseClassesRelease
> Task :ba:compileReleaseShaders NO-SOURCE
> Task :ba:generateReleaseAssets UP-TO-DATE
> Task :x:generateReleaseRFile
> Task :ba:packageReleaseAssets
> Task :ba:prepareLintJarForPublish
> Task :ba:prepareReleaseArtProfile
> Task :ba:writeReleaseAarMetadata
> Task :ba:processReleaseManifest
> Task :video:compileReleaseKotlin
> Task :ba:mapReleaseSourceSetPaths
> Task :video:compileReleaseJavaWithJavac NO-SOURCE
> Task :video:bundleLibCompileToJarRelease
> Task :ba:mergeReleaseResources
> Task :d:compileReleaseLibraryResources
> Task :hb:compileReleaseLibraryResources
> Task :lf:compileReleaseLibraryResources
> Task :t:compileReleaseLibraryResources
> Task :video:compileReleaseLibraryResources
> Task :ba:generateMetadataFileForAarPublication FAILED
> Task :base:compileReleaseLibraryResources
> Task :o:compileReleaseLibraryResources
> Task :x:compileReleaseLibraryResources
> Task :x:compileReleaseKotlin

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ba:generateMetadataFileForAarPublication'.
> Invalid publication 'aar':
    - This publication must publish at least one variant

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org/.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.9/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 3m 30s
106 actionable tasks: 106 executed
Gradle task failed: exit status 1

Reproduction steps

  1. Try setup the configuration above in a multi-module Android project using KTS.
  2. Set Artifactory plugin to 5.1.10
  3. Check that it works
  4. Upgrade Artifactory to 5.2.5
  5. Exception should occur

Expected behavior

Expectation is that the build still succeeds or that the error message provides more information on what went wrong.

Artifactory Gradle plugin version

5.2.5

Operating system type and version

Linux Ubuntu 22.04 and MacOS 15.1.1 Sequoia

JFrog Artifactory version

No response

Gradle version

8.9

@TomTruyen TomTruyen added the bug Something isn't working label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant