How do I include .class files as dependencies? I've only seen jar examples

I’m trying to automate a build with a lot of dependencies, many are .jars, but some are just plain.class files.
For example, if I have some dependencies on an external drive like this:

X:/Dependencies
  - dom4j1.6.1.jar
  - myPackage
      -myClass.class
      -otherClass.class

How do I reference those .class files as dependencies in build.gradle? This is what I have currently:

apply plugin: 'idea'
apply plugin: 'java'

sourceSets.main.java.srcDirs = ['src']

repositories{
    flatDir{
        dir 'X:/Dependencies'
    }
}

dependencies{
    compile ':dom4j1.6.1'
    compile 'myPackage/myClass.class'
    compile 'myPackage/otherClass.class'
}

It successfully finds dom4j1.6.1.jar, but it can’t find the .class files. How can I make it find them?

Also, bonus question: Why does it stop finding dom4j1.6.1 if I remove the leading colon?
It says: supplied String module notation 'dom4j1.6.1' is invalid. I think I’m confused about how to make gradle search the network drive I specified in the repositories section instead of it just searching inside the local project directory.

Any help is appreciated, thanks.

1 Like