Reputation: 1679
I can't get my script to wait until libraries are copied over to 'src/main/resources/libs' before it starts to jar up everything. The files are copied over but the jar task I think is not waiting until the files are copied over? Because they are not added to my jar. Unless I run script again :/ How to fix this?
task copyDependencies(type: Copy) {
from configurations.myLib
into 'src/main/resources/libs'
}
jar.dependsOn 'copyDependencies'
jar {
manifest {}
}
Upvotes: 1
Views: 289
Reputation: 123910
To get the execution order right, processResources
would have to depend on copyDependencies
. However, you shouldn't copy anything into src/main/resources
. Instead, the libraries should be included directly in the Jar, without any intermediate steps:
jar {
into("libs") {
from configurations.myLib
}
}
This assumes that there is some custom process or class loader in place that makes use of the libraries in the Jar's libs
directory. A standard JVM/class loader will ignore them.
Upvotes: 2