Reputation: 1666
I have dependencies block in my configuration:
dependencies {
compile ...
}
Now I'm trying to create a task which will build a specific debug artefact:
task buildDebugRpm (type: Rpm) {
requires('java-1.8.0-openjdk', '1.8.0.0', GREATER | EQUAL)
...
}
Artefact built in this task should include AspectJ libraries in runtime. But I don't want to have them in my common project dependencies.
Is there a way to add "org.aspectj:aspectjrt:1.8.9", "org.aspectj:aspectjweaver:1.8.9"
libs only for this specific task?
Upvotes: 2
Views: 1986
Reputation: 432
You can create a custom configuration and add the dependencies to it:
configurations {
debugRpm {
extendsFrom compile
}
}
dependencies {
compile ...
debugRpm 'org.aspectj:aspectjrt:1.8.9'
debugRpm 'org.aspectj:aspectjweaver:1.8.9'
}
Then include these dependencies in the task:
task buildDebugRpm (type: Rpm) {
...
from(configurations.debugRpm) {
into 'lib'
}
}
Upvotes: 2