Disclaimer: I am no Java expert and this article is mainly for my own reference as I solved this issue multiple times and forgot hot I resoved it every single time....
Here we are trying to resolve the message:
error: module not found: jakarta.activation
when building a maven project (in my case glassfish-jaxb).
There are a couple of indications and solutions that can fix it for example replacing the artifact names:
Steps to resolution should be:
- Run `mvn dependency:tree` to get an overview on dependencies and who might need "activation"
- Run mvn with debug logging to identify locations in the logs. Keep an eye out for "exclusion", "conflict", "module"
- Find the module that causes the error.
- Identify what other artifacts the failed module uses.
With that information, you can try fixing your source as mentioned in the link above. If you know your source is meant to build, check your OS. The OS might have some artifacts installed, that are required by your module (see step 4 above). These artifacts might be too new/different and require jakarta.activation. So that needs to be resolved.
In my case the istack-commons version was too new.
Some more background:
With Java 9, javax.activation has been deprecated and removed with Java 11. Eclipse has taken over the development. There are multiple solutions that offer these features like
JavaBeans Activation Framework (jaf)
Based on the used versions, the artifact name changes between com.sun.actication:javax.activation or jakarta.activation:jakarta.activation or java.activation.