After creating my war file with mvn package, war file include web/INF lib folder. In that folder, there are some jars which I did not prefer because of the versions of jar. I cannot manage the version of these jars directly. Some spring plugins/packages manages this. I tried to increase the versions of plugins which in pom.xml but it did not bring exact version which I need.
How can I change it with mvn commands or pom.xml?
CodePudding user response:
Your project have some jars in web/INF lib,there can not change with mvn. You should find this jars what you want version in internet,download and replace.
But I suggest you use mvn manage this jars.
CodePudding user response:
You can get a clear view of the hierarchy of dependencies with this command:
mvn dependency:tree
To exclude a jar from the war, you need to specify the scope with "provided" value. So, you need to add (for a dependency of a dependency) or change the corresponding dependency block:
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
Another way is to configure the plugin that does the magic:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<packagingExcludes>WEB-INF/lib/spring-aop-5.3.19.jar</packagingExcludes>
</configuration>
</plugin>