jsfjakarta-eemojarra

Eclipse Mojarra vs (jakarta.faces » jakarta.faces-api)


I know that Mojarra is Eclipse EE4J implementation of the Jakarta Faces specification.
But what about this dependency:

<!-- https://mvnrepository.com/artifact/jakarta.faces/jakarta.faces-api -->
<dependency>
    <groupId>jakarta.faces</groupId>
    <artifactId>jakarta.faces-api</artifactId>
    <version>4.0.0</version>
</dependency>

Obviously it is also an implementation of Jakarta Faces specification implemented by Eclipse EE4J as well:
https://github.com/jakartaee/faces

So, are they same project or not? and what is the difference between them?


Solution

  • Obviously it is also an implementation of Jakarta Faces specification implemented by Eclipse EE4J as well

    No, it is not.

    Follow the https://mvnrepository.com/artifact/jakarta.faces/jakarta.faces-api link and download the JAR file and inspect its contents using any zip tool. You'll see that it contains only jakarta.* classes. It does not contain classes from the implementation package such as com.sun.faces.* (Mojarra) or org.apache.myfaces.* (MyFaces). In other words, it only contains the API classes not the impl classes.

    This JAR file is essentially the "Jakarta Faces specification" part of your first statement:

    I know that Mojarra is Eclipse EE4J implementation of the Jakarta Faces specification.

    As to,

    So, are they same project or not

    no, the Mojarra project is here https://github.com/eclipse-ee4j/mojarra and the Mojarra dependency is here:

    <!-- https://mvnrepository.com/artifact/org.glassfish/jakarta.faces -->
    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>jakarta.faces</artifactId>
        <version>4.0.0-M1</version>
    </dependency>
    

    Download the JAR file and inspect its contents. You'll see that it contains jakarta.* classes and com.sun.faces.* classes.

    what is the difference between them?

    The API can be included as <scope>provided</scope> in projects targeting a full fledged Jakarta EE server which already ships with API+impl out the box. You'll then be able to import jakarta.faces.* classes in your code. For those servers, you only need to include the impl (Mojarra or MyFaces) as <scope>provided</scope> if you wish to be able to step through the source code in IDE's debugger and/or if you wish to monkeypatch some implementation classes.

    But in barebones servletcontainers such as Tomcat, the API dependency as <scope>compile</scope> won't work because the implementation is missing. You'll need the impl dependency instead.

    See also: