How do i configure maven so that it uses jar for compilation but excludes all of them while bundling into a war file<>
This question already has an answer here:
That's what provided scope is about. From Maven docs about provided:
This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.
Do you create the WAR file using the maven-assembly-plugin? If so, you can exclude the dependencies being copied.