Sure, .class files know nothing about their dependencies. You may include these dependencies manually using DependsOn. But general way is to publish an artifact, i.e. to local Maven repository. Artifact consists not only of jar where class files are located but it also contains pom.xml where dependencies are described. Syntax for including artifacts from maven local is:
@file:Repository ("*mavenLocal")
@file:DependsOn ("groupartifactIDversion")