在gradle中,当我试图构建每个模块时,我需要将外部依赖项也打包在Jar中作为Jar。gradle构建一个外部依赖项作为Jar内部的依赖关系
下面是一些依赖列了出来:
dependencies {
compile group: 'org.springframework.integration', name: 'spring-integration-xml', version:'4.1.6.RELEASE'
compile group: 'org.springframework', name: 'spring-oxm', version:'3.0.0.RELEASE'
....
}
jar {
manifest{
attributes 'Main-Class':'com.MyfirstClass'
}
}
最后,当我们试图查看JAR它应该包含内部的lib依赖jar如下图所示提前
jar tvf build/libs/test.jar
META-INF/
META-INF/MANIFEST.MF
lib/
lib/spring-integration-xml.4.1.6.jar
.....
谢谢!
[使用摇篮构建具有依赖关系的罐子]的可能的复制(https://stackoverflow.com/questions/4871656/using-gradle-to-build-a-jar-with-dependencies) –