Gradle analogue to Maven 'unpack' option in assembly

Hi , I am trying to create a gradle jar containing junit tests and its dependencies, so that I can run them from command line. With my current approach I am able to create compiled tests and its dependencies, but all dependency libraries get unpacked by default and are present as class files within the main jar file.

task testJar(type: Jar) {
    from {
        configurations.unitTests.collect { it.isDirectory() ? it : zipTree(it) }
    }

    from (sourceSets.test.output) {
        include(['com/myproj/robo/envite/unitTests/*.class', 'com/myproj/robo/envite/unitTests/abc/*.class', 'com/myproj/robo/envite/'])
    }
    archiveFileName = "envite-tests.jar"
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

The above code creates a jar containing all tests and their dependencies that are all unpacked. I am looking for something like a jar file containing more jar files inside it.
-envite-tests.jar
--------onlyTests.jar
--------dependencylib1.jar
--------dependencylib2.jar
etc

I was able to achieve it in Maven assembly by setting ‘unpack’ flag as false.

<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
    <id>envite-tests</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory>/</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <useProjectAttachments>true</useProjectAttachments>
            <unpack>false</unpack>
            <scope>test</scope>
        </dependencySet>
    </dependencySets>
</assembly>

Is there any way to achieve the similar in gradle ?

The dependencies of the unitTests configuration are unpacked because of the use of zipTree. Are these the dependencies you are referring to? If so, using from configurations.unitTests should give you what you want.