我有2个模块:
transfer-application
transfer-executable
我需要将transfer-executable
打包为zip
并将其作为依赖项添加到transfer-application
中,
dependencies {
zip project(':transfer-executable')
}
我希望zip在classpath中可用。 Gradle是否使用本机api提供此类功能。如果没有,我需要使用哪个库?
如果可以,请提供实施示例。
答案 0 :(得分:0)
等级:
dependencies {
def execBuildDir = project(':transfer-executable').buildDir
runtime fileTree(dir: "$execBuildDir/distributions", include: '*.zip')
}
检查是否有效:
> jar tf transfer-application/build/libs/transfer-application-1.0.0-SNAPSHOT.jar | grep zip
BOOT-INF/lib/transfer-executable-1.0.0-SNAPSHOT.zip
BOOT-INF/lib/spring-cloud-starter-zipkin-2.1.0.RELEASE.jar
BOOT-INF/lib/spring-cloud-sleuth-zipkin-2.1.0.RELEASE.jar
BOOT-INF/lib/zipkin-sender-kafka11-2.7.14.jar
BOOT-INF/lib/zipkin-sender-amqp-client-2.7.14.jar
BOOT-INF/lib/zipkin-reporter-2.7.14.jar
BOOT-INF/lib/zipkin-2.12.0.jar