Java-Seekar
Java-Seekar

Reputation: 1770

Include jars files from the sub folders in gradle

We maintain different folders to keep all the jars.

Ex:

Repo
\-- lib
    \-- test
        \-- junit.jar
    \-- hibernate
        \-- hibernate.jar

I used the bellow code.

repositories {
    flatDir {dirs "../Repo/lib/*"}      
}

If I put all the jars in lib it works fine. But If I put it in different folders it give the compilation error.

I tried with this

repositories {
        flatDir {dirs "../Repo/lib/**"}     
    }

Please guide me.

Upvotes: 5

Views: 7140

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123890

When declaring a flatDir repository, you need to pass a (relative or absolute) directory path. You can't use wildcards, but may pass multiple directory paths. For example:

repositories {
    flatDir {
        dirs "../Repo/lib/lib1", "../Repo/lib/lib2"
    }
}

For further details, see the Gradle Build Language Reference.

Upvotes: 11

Related Questions