mfuerstenau / gradle-buildconfig-plugin

A BuildConfig plugin for Gradle java projects
MIT License
173 stars 20 forks source link

Compilation failure with gradle 7.0+ #30

Open chirag-ji opened 3 years ago

chirag-ji commented 3 years ago

While upgraded to gradle 7.0.2 version. I am experiencing a problem that applying id "de.fuerstenau.buildconfig" version "1.1.8" throwing below gradle exception

Caused by: org.gradle.api.GradleException: Configuration not found

Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'compile' not found. at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.createNotFoundException(DefaultConfigurationContainer.java:165) at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:333) at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:155) at org.gradle.api.internal.artifacts.configurations.ConfigurationContainerInternal$getByName.call(Unknown Source) at de.fuerstenau.gradle.buildconfig.BuildConfigPlugin.getCompileConfiguration(BuildConfigPlugin.groovy:73)

build.gradle

plugins { id 'org.springframework.boot' id 'java' id 'war' id "de.fuerstenau.buildconfig" version "1.1.8" }

Please take a look

heyalistair commented 3 years ago

Also getting this error at 1.1.8 for gradle 7!

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':my-project'.
> Configuration <compile> not found.
oizo commented 3 years ago

I've found a workaround, that seems to be working. I've just created an empty compile configuration.

configurations {
    create("compile")
}

But then I get a new issues which is:

Execution failed for task ':jar'.
> Entry com/fiftytwo/vim/BuildConfig.class is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/7.2/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.

Which is then solved by adding a DuplicatesStrategy to my jar task.

tasks {
    withType<Jar> {
        duplicatesStrategy = DuplicatesStrategy.INCLUDE
    }
}

I hope this will float the boat until a fix is out.

NightXlt commented 2 years ago

may be you could try a compatible 7.3.2 version made by myself: https://github.com/mfuerstenau/gradle-buildconfig-plugin/pull/31