简体   繁体   中英

Add jar dependency to gradle task without actually including its classes to the output

I currently use gradle build script that looks like this:

apply plugin: 'java'

dependencies { 
    compile files('libs/android.jar')
}

I need now to build a jar that doesn't include classes from android.jar

Any ideas?

您将要使用功能变体来建模“可选”依赖项: https : //docs.gradle.org/current/userguide/feature_variants.html

So, the jar that is built this way contains only classes built from java files. To include them, use Shadow. If you want them just to be compile-time classpath, use compileClasspath property of java source set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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