在gradle中包含子文件夹中的jar文件

时间:2014-01-28 15:56:53

标签: gradle

我们维护不同的文件夹以保留所有罐子。

前:

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

我使用了以下代码。

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

如果我把所有的罐放在lib中它可以正常工作。但是,如果我将它放在不同的文件夹中,则会出现编译错误。

我试过这个

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

请指导我。

1 个答案:

答案 0 :(得分:8)

声明flatDir存储库时,需要传递(相对或绝对)目录路径。您不能使用通配符,但可以传递多个目录路径。例如:

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

有关详细信息,请参阅Gradle Build Language Reference