Help required to migrate from 7.6 to 8.X version

Hi ,

Currently I am using gradle 7.6 version and would like to migrate it with 8.X version. Below is my build.gradle file .Can some please help me to migrate it with gradle 8.x version. Thanks in advance


defaultTasks 'createJar', 'aggregate'

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
       
    }
}

group 'com.orgs.project'
version '1.0'

apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'idea'


dependencies {
    //Reporting
    

}


    tasks.create(name: "smoke-${region}", type: Test) {
        outputs.upToDateWhen { false }
        ignoreFailures = true
        finalizedBy(aggregate)
        group = "Environments"

        doFirst {
            

            useJUnitPlatform {
                if (project.hasProperty('includeTags')) {
            }
          }
       }
    }
    
    tasks.create(name: "regression-${region}", type: Test) {
        outputs.upToDateWhen { false }
        ignoreFailures = true
        finalizedBy(aggregate)
        group = "Environments"

        doFirst {
            

            useJUnitPlatform {
                if (project.hasProperty('includeTags')) {
            }
          }
       }
    }



task SingleRun(type: Test) {
    outputs.upToDateWhen { false }
    ignoreFailures = true
    finalizedBy(aggregate)
    group = "Environments"

    doFirst {


        useJUnitPlatform {
           
        }

    }
}


task Run(type: Test) {
    outputs.upToDateWhen { false }
    ignoreFailures = true
    finalizedBy(aggregate)
    group = "Environments"

    doFirst {


        useJUnitPlatform {
           
        }

    }
}




task cleanReports{
    project.logger.lifecycle("Starting Task: cleanReports")
    finalizedBy(clean)

    doLast{
        project.delete(files("target/json") {})
        project.delete(files("target") {})
    }
}


tasks.withType(Test) {
//    maxParallelForks=2
    testLogging {
        events "FAILED",
                "SKIPPED",
                "STANDARD_ERROR",
                "STANDARD_OUT"
        exceptionFormat "FULL"
        showCauses true
        showExceptions true
        showStackTraces true
        showStandardStreams true
    }
}

Besides that you use quite some legacy things and bad practices, what is your problem?
If you just want someone to do the work for you, please search someone you can hire.
This is a community forum that helps you with concrete problems or questions you have.

If you are on the latest 7.x version and do not get any deprecation warnings from Gradle, your build should usually already be ready to be used with 8.x.

Hey, I am not asking you to do my work. I am trying to migrate my project from from gradle 7.6 to 8.1 and while migrating getting below error

Execution failed for task ‘:regression-region’.

The value for task ‘:regression-region’ property ‘testFrameworkProperty’ is final and cannot be changed any further.

You try to change the configuration of that task during its execution time.
This is a very bad idea and as you see also does not work anymore in this specific case. :slight_smile:

Its working with 7.6 gradle only issue when I am trying to migrate to latest version 8.2. I am passing region info through command line during execution. Not too sure if do first is causing issue and hence I posted for the help if someone can help with their thoughts to fix it

Yes, it is, as I said.
doFirst { ... } is done at execution time and you should not change task configuration at execution time and with 8+ even cannot in this case.
Move the configuration to configuration time, i.e. outside do... { ... } and that detail should be fine.

Do you have any working example or reference ?
I am not a developer so refrence would helpful , thanks

I already told you exactly how to solve it, so I don’t know what else to say, other than linking you to the docs: Testing in Java & JVM projects.

But if you are not a developer, I wonder why you do developer’s work.
Maybe you should let a developer do it instead. :slight_smile: