Could not get unknown property 'sourcesJar'

Migrating project from gradle 6.8.3 to 8.0 but getting the build error as follows.
Could not get unknown property ‘sourcesJar’ for object of type org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler.
any suggestions on this?

Hard to guess without you showing your build script.
But it seems you try to use sourcesJar property - probably to refer to the sourcesJar task - while no such task exists.
I’d recommend not skipping a major version anyway though.
Upgrade to latest 6.x, fix all deprecation warnings, then upgrade to latest 7.x, fix all deprecation warnings, then upgrade to latest 8.x.