How can I add *.class files to dependencies during java project build?

I want to add *.class files to dependencies of java project. I’ve found out in documentation such example but it doesn’t work.

dependencies {
implementation(fileTree('myClassFilesDir') { include '*.class' })
}

How can I add *.class files to dependencies of java project?