I have a springboot project which uses package javax.servlet from org.apache.tomcat.embed:tomcat-ember-core9.0.34. (this is coming from springboot)

I have another maven project (API project) which uses this javax.servlet but with version 2.3

Now I have created a parent maven project which includes above 2 projects as modules.
When I individually compile the springboot project, everything is fine.
But when I compile the parent project, it takes the javax.servlet.api version 2.3 to compile the springboot project and gives error, since a method is not available in 2.3 which is being used by springboot.

How to solve this?

**Please find a sample source code here:** <https://github.com/abmjunaed/maven-multi-project-error>

*I have added very minimal code to reproduce the scenario so that you can have a look and help!*

In the External Libraries of IntelliJ, I can see both libs and maven from the parent project is taking the javax-servlet-api:2.3 to compile the springBoot project and giving the error

[![enter image description here](https://i.stack.imgur.com/xJEDh.png)](https://i.stack.imgur.com/xJEDh.png)