I am facing certain issues while migrating my Java project from 4.10 to latest 7.4 version of Gradle. Most challenging is regarding the compatibility of tasks.
Overwriting already realized tasks that thus could have been used by some plugins already has been deprecated with Gradle 5 and removed with Gradle 6.
If the package task you want to replace is not realized yet, but was added using task configuration avoidance (tasks.register), then you can to a certain extent use tasks.replace, but even then I’d recommend to just not do it but seek a cleaner way to achieve what you want.
Generally the task "package"(type: Copy) syntax is still supported, but you will not benefit from task configuration avoidance as that is an eager way to add a task, so using tasks.register is indeed the recommended way now.
With tasks.register you just give the type as second argument to the method call when you are using Groovy DSL (tasks.register("package", Copy) { ... }). If you were using Kotlin DSL (I can only recommend it, especially for type-safety and amazing IDE support when using IntelliJ) you could also use a generic type argument. (tasks.register<Copy>("package") { ... }).
Any help/pointer to the documentation where I can find how to write/configure tasks in 7.4 ?
The Gradle documentation is imho a great resource.