How to declare file dependencies without including the same files in the Jar?

I’m using Gradle in a project set-up where part of the world is a bit upside-down.

The project is build as an extension to an existing system with no dependency management. Our compilation is therefore depending on a lot of class- and Jar files. We do however not want to include these class and Jar files in our Jar file, since our jar file is simply deployed into the product.

How do I specify dependency to a file tree, but tell Gradle that the same files should not be included in the Jar file?

Thank you in advance!

Dependencies aren’t automatically included in the Jar, so it’s just:

dependencies {
    compile fileTree(...)

Thank you, Peter!

Is there a (good) way to declare different kinds of dependencies, e.g. if a given dependency should be included or not?

I’d like to include sub project jar files, but not include everything the project depends on.