The war
plugin provides a providedCompile
configuration for dependencies.
The java
plugin needs this also. There are some workarounds but they are incomplete or require third party libraries.
Justification: if building a jar file for a servlet filter, the servlet needs to have a providedCompile
dependency on servlet-api. The servlet filter is a reusable class that is meant to be embedded in war files. Thus, the project is not a war project, just a jar, so using the war
plugin is incorrect.
By extension, the eclipse
and other ide plugins should recognize this configuration and perform the correct code/configuration code generation for java projects.