Gradle把model层打为jar包

xiaoxiao2021-02-27  352

1. Gradle把model层打为jar包,供其他工程使用

Gradle代码:

task buildModel(type: Jar, dependsOn: build) { baseName = 'test-model' //生成jar包的名称 from('build/classes/main/com/test/model') //要打包的内容 into( 'com/test/model') //jar包中的相对路径 }

2. 在其他工程中引用本地jar包

Gradle代码:

compile files('lib/test-model.jar') \\引号中为jar包路径
转载请注明原文地址: https://www.6miu.com/read-6018.html

最新回复(0)