Excluding jar/subdependency from a main dependency from a maven project

Reading Time: < 1 minute

In my project at work, the front end java framework ZKoss I use at work, pulls servlet api jar on its own since its dependency is required for the jar, it was mismatching one i was using. So I had to exclude the jar from zkoss dependency

the below is the ZK’s required jar and I am excluding servlet-api from the dependency and pulling the servlet-api upon my request.

<!-- ZK Spring dependencies servlet-api being excluded-->
		<dependency>
			<groupId>org.zkoss.zk</groupId>
			<artifactId>zkspring-core</artifactId>
			<version>${zk-spring.version}</version>
			<exclusions>
				<exclusion>
					<groupId>javax.servlet</groupId>
					<artifactId>servlet-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

<!--This is the one I am pulling from maven's repo -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>${servlet-api.version}</version>
		</dependency>