简体   繁体   English

在gradle中将本地jar文件添加到项目的依赖项

[英]Add a local jar file to dependencies of a project in gradle

I have two java projects. 我有两个Java项目。 The first one builds a jar archive with so libraries: 第一个建立一个JAR归档so库:

jar {
    from('libs') {
        include '**/*.so'
        into('native-libs')
    }
}

so files are included in the first jar. so文件包含在第一个jar中。

The second one depends on the first and should include all files from the first. 第二个依赖于第一个,并且应包括第一个中的所有文件。 I write: 我写:

dependencies {
    compile project(':project-native')
}

but in the second jar I don't see files from the first project. 但是在第二个jar中,我看不到第一个项目中的文件。

Any ideas? 有任何想法吗?

A project dependency adds the dependent JAR file to the classpath of that project. 项目依赖项将依赖的JAR文件添加到该项目的类路径中。 It does not merge the classes into its JAR file. 它不会将这些类合并到其JAR文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM