问题
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