Recently I changed our build scripts from a self defined configuration named “provided” which we used for excluding unwanted dependencies going into the WAR and used instead the new ‘compileOnly’. I was surprised that this did not give me what I expected. Dependencies marked with 'compileOnly showed up in WEB-INF/lib .
I have the suspicion this is due to the fact that subprojects which are included into the WAR do not declare these unwanted dependencies as ‘compileOnly’, but use them as ‘compile’ dependencies. Therefore, declaring ‘compileOnly’ dependencies in the subproject which is responsible for the WAR has not the effect I hoped it had.
Question: does this explain why the WAR contains those unwanted dependencies?
I found a solution working for me in “How can I exlude files from WAR when using WAR plugin against default or webAppDirName location”, where user ‘Daz’ pointed to something like this: