I'm bulding an embeded Jetty application with Maven. jetty.version: 11.0.13 servlet-api.version: 5.0.0.
It is a multi module project.
One maven module, named "utils", depends on jakarta.servlet-api for compilling (scope is provided). The java module requires jakarta.servlet.
// utils' pom.xml
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
The maven "application" module adds the following dependencies and others.
// application's pom.xml
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>
One of the other explicit dependency depends on the "utils" maven module.
The application's Java module contains:
requires utils;
requires org.eclipse.jetty.http;
requires org.eclipse.jetty.server;
requires org.eclipse.jetty.servlet;
When I compile the application, all dependency modules compile OK but I get this error when compilling the last module (the application) :
myapplication.BlaBla.java:[46,17] cannot access jakarta.servlet.http.HttpServlet class file for jakarta.servlet.http.HttpServlet not found
If I add the following dependency:
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
and add the following line to my application's module:
requires jakarta.servlet;
My editor warns:
Module 'application' reads package 'jakarta.servlet' from both 'jetty.servlet.api' and 'jakarta.servlet'
And the build obviously fails with many error messages like:
[ERROR] module org.eclipse.jetty.server reads package jakarta.servlet from both jetty.servlet.api and jakarta.servlet [ERROR] module org.eclipse.jetty.server reads package jakarta.servlet.http from both jetty.servlet.api and jakarta.servlet [ERROR] module org.eclipse.jetty.server reads package jakarta.servlet.descriptor from both jetty.servlet.api and jakarta.servlet [ERROR] module org.eclipse.jetty.server reads package jakarta.servlet.annotation from both jetty.servlet.api and jakarta.servlet [ ...
If I look at the jetty.servlet.api jar file, I see no package named jakarta.servlet.
I did notice that "jetty-jakarta-servlet-api-5.0.2.jar" contains the jakarta.servlet classes but I don't know to use this in my build process.
Help?