Reputation: 1254
I have a Gradle project which consists of 3 modules:
project-core
(no dependencies)project-web
(depends on project-core
)project-plugin
(depends on both modules)I don't want to manually add the plugin to the classpath of project-web
every time I make a WAR, so I would like to extend the WAR task and create a "warWithPlugin" task, which adds the plugin jar to the libs folder as well.
Obviously I can't add project-plugin
as a dependency, because I get a circular dependency. What other options do I have to package the plugin jar into the WAR?
Upvotes: 3
Views: 1351
Reputation: 13466
Sure, you can just create a new configuration with project-plugin
as a dependency then add that configuration to your WEB-INF/lib
directory.
configurations {
plugin
}
dependencies {
plugin project(':plugin')
}
war {
into('WEB-INF/lib') {
duplicatesStrategy 'exclude'
from configurations.plugin
}
}
Upvotes: 1