How to Copy dependencies to Build directory in Gradle

ⅰ亾dé卋堺 提交于 2019-12-08 09:06:33

问题


How to Copy dependencies to Build directory in Gradle without adding any tasks in build.gradle like mvn dependency:copy-dependencies..


回答1:


If you really don't want a task for this you could use the copy method of the project object.

configurations {
    compile
}

dependencies {
    compile 'someGroup:someArtifact:someVersion'
}

project.copy {
    from project.configurations.compile
    into project.buildDir
}

One noticeable effect of this is that the resolving will be triggered for every invokation i.e. even if you only want to list tasks the resolve and copy will be triggered.



来源:https://stackoverflow.com/questions/47567864/how-to-copy-dependencies-to-build-directory-in-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!