spring-gradle-plugins / dependency-management-plugin

A Gradle plugin that provides Maven-like dependency management functionality
686 stars 85 forks source link

Configuration cache issue with StandardPomDependencyManagementConfigurer #312

Open lkoe opened 2 years ago

lkoe commented 2 years ago

When using the following snippet to package the generated Maven POM into the jar a configuration cache issue comes up:

    project.tasks.withType(GenerateMavenPom::class) {
        jar {
            into("META-INF/maven/${project.group}/${project.name}") {
                from(this@withType)
                rename(".*", "pom.xml")
            }
        }
    }

From the configuration cache report:

task:appkit-common:generatePomFileForKonsensPublication📋 of type org.gradle.api.publish.maven.tasks.GenerateMavenPom📋
⌄fieldmavenPomSpec📋 of org.gradle.api.publish.maven.tasks.GenerateMavenPom📋
⌄bean of type org.gradle.internal.serialization.Cached$Fixed📋
⌄fieldresult📋 of org.gradle.internal.serialization.Cached$Fixed📋
⌄bean of type org.gradle.internal.Try$Success📋
⌄fieldvalue📋 of org.gradle.internal.Try$Success📋
⌄bean of type org.gradle.api.publish.maven.internal.tasks.MavenPomFileGenerator$MavenPomSpec📋
⌄fieldxmlTransformer📋 of org.gradle.api.publish.maven.internal.tasks.MavenPomFileGenerator$MavenPomSpec📋
⌄bean of type org.gradle.internal.xml.XmlTransformer📋
⌄fieldactions📋 of org.gradle.internal.xml.XmlTransformer📋
⌄bean of type org.gradle.internal.MutableActionSet📋
⌄fieldactions📋 of org.gradle.internal.MutableActionSet📋
⌄bean of type org.gradle.internal.ImmutableActionSet$SingletonSet📋
⌄fieldsingleAction📋 of org.gradle.internal.ImmutableActionSet$SingletonSet📋
⌄bean of type org.gradle.api.internal.UserCodeAction📋
⌄fielddelegate📋 of org.gradle.api.internal.UserCodeAction📋
⌄bean of type io.spring.gradle.dependencymanagement.internal.StandardPomDependencyManagementConfigurer📋
›fielddependencyManagement📋 of io.spring.gradle.dependencymanagement.internal.StandardPomDependencyManagementConfigurer📋
›fieldpomResolver📋 of io.spring.gradle.dependencymanagement.internal.StandardPomDependencyManagementConfigurer📋
fieldproject📋 of io.spring.gradle.dependencymanagement.internal.StandardPomDependencyManagementConfigurer📋

It seems that StandardPomDependencyManagementConfigurer is holding unsupported state in fields dependencyManagement, pomResolver and project

wilkinsona commented 2 years ago

Thanks for the report. The limitations of Gradle's configuration cache may be too severe here and this might not be something that it's possible to support. We can take a look, but I'm not too hopeful. In the meantime, you may be able to avoid the problem by disabling customization of the generated pom. This, of course, may mean that the pom no longer meets your needs. If that's the case, you may also want to consider investigating Gradle's built-in platform support as a replacement for this plugin.

lkoe commented 2 years ago

I tested disabling the pom customizations as suggested, unfortunately it doesn't help with this issue.

I suppose thats because StandardPomDependencyManagementConfigurer is still being added as POM customization and only it's internal logic affected by the flag.