在 gradle 中,当我尝试构建每个模块时,我需要将外部依赖项也打包在 Jar 中作为 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
.....
提前致谢!