researchgate / gradle-release

gradle-release is a plugin for providing a Maven-like release process for projects using Gradle
MIT License
859 stars 223 forks source link

Unable to configure releases with protected main branch in Gradle #387

Closed fraucamidokura closed 7 months ago

fraucamidokura commented 7 months ago

Description:

I'm currently facing an issue while trying to configure releases in my Gradle project on a protected main branch. I want to prevent direct commits to the main branch and have a user with push access for making releases. However, when attempting to add the --force option to the release configuration, I encounter the following error:

A problem occurred evaluating root project 'app'.
> Cannot cast object '[--force]' with class 'java.util.ArrayList' to class 'org.gradle.api.provider.ListProperty' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.gradle.api.provider.ListProperty(String)

Steps to Reproduce:

  1. Add the following configuration to your Gradle script:
 release {
        git {
            pushOptions = ["--force"]
        }
    }
  1. Execute the build or release command.
gradle release

Expected behavior:

The release configuration should be applied without any errors, and the --force option should be accepted.

Environment:

Gradle Version: 8.5
Plugin version: net.researchgate.release:3.0.2

Thank you for your assistance!

fraucamidokura commented 7 months ago

I did found the solucion myself

release {
    git {
        pushOptions.set(["--force"])
    }
}

Sorry for opening the bug too soon