Reputation: 24118
I use maven-war-plugin
in my pom to build my Vaadin application. My question is, if I added an unnecessary dependency (dependent library is not actually used in code) to my pom, Will maven-war-plugin
still bundle the dependency into the war file it generates?
Upvotes: 0
Views: 116
Reputation: 522331
The answer to your question depends on the scope you specify in the <dependency>
tag. Consider the following dependency tag:
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>provided</scope>
</dependency>
The provided
scope tells Maven to use the log4j
JAR when compiling but to exclude it from the build, so it would not appear in your WAR. If, on the other hand, you used a scope of compile
or runtime
, then it would appear in the WAR.
If you don't specify any <scope>
, then the default is compile
, which means that the depedency will appear in the build output.
Upvotes: 2