DEV Community

Cover image for Understanding Jakarta EE 8: The tutorial series
Buhake Sindi
Buhake Sindi

Posted on • Edited on

Understanding Jakarta EE 8: The tutorial series

Understanding Jakarta EE 8: The Intro series.

Welcome to my new series called "Understanding Jakarta EE 8". A tutorial series that tackle various Jakarta EE 8 technologies.

What is Jakarta EE 8?

Jakarta EE 8 marks the new era in the Java Ecosystem. It is essentially Java EE 8 but it is governed by the Jakarta EE Working Group, What's important is that the Jakarta EE project is operated under an open source process - the Jakarta EE Specification Process (JESP). My previous article explains the history of Jakarta EE 8.

The Jakarta EE 8 application are run on reference runtimes (also known as "containers"). This simplifies development as it provide for the separation of business logic from resource and lifecycle management, which means that developers can focus on writing business logic -- their value add -- rather than writing enterprise infrastructure. Also, the Java EE architecture provides services that simplify the most common challenges facing developers when building modern applications, through the sets of APIs thus making it easier to use popular design patterns and industry-accepted best practices.

You can find the list entire Jakarta EE 8 specification, along with the specifications of its set of APIs here.

Outcome of these tutorial series

The outcome of these tutorial series is to enable enterprise Java developers to be able to develop and deploy enterprise Java applications comfortably.

Bootstrapping your Jakarta EE 8 application.

Using Maven, the latest version of Java (Java 13 at the time of writing), it's pretty straightforward to include your Jakarta EE 8 application on your project.

The pom.xml is pretty straightforward configuration to include Jakarta EE 8.

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>za.co.sindi</groupId>
      <artifactId>jakartaee-tuts</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <name>JavaEE Tutorial - CDI</name>
      <description>Understanding Jakarta EE 8</description>

        <properties>
            <maven.compiler.source>13</maven.compiler.source>
            <maven.compiler.target>13</maven.compiler.target>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <maven.version>3.6.3</maven.version>
            <jakarta.jakartaee-api.version>8.0.0</jakarta.jakartaee-api.version>
            <junit-jupiter.version>5.6.0</junit-jupiter.version>
            <javax.jaxb-api.version>2.3.1</javax.jaxb-api.version>
            <!-- Plugin versions -->
            <version.liberty-maven-plugin>3.2</version.liberty-maven-plugin>
            <version.maven-compiler-plugin>3.8.1</version.maven-compiler-plugin>
            <version.maven-enforcer-plugin>3.0.0-M3</version.maven-enforcer-plugin>
            <version.maven-surefire-plugin>3.0.0-M4</version.maven-surefire-plugin>
            <version.maven-failsafe-plugin>3.0.0-M4</version.maven-failsafe-plugin>
            <slf4j-log4j12.version>1.7.30</slf4j-log4j12.version>
            <org.jboss.weld.se.core.version>3.1.4.Final</org.jboss.weld.se.core.version>
        </properties>

        <developers>
            <developer>
                <name>Buhake Sindi</name>
                <email>buhake.sindi@sindi.co.za</email>
                <organization>Sindi Technologies Pty (Ltd)</organization>
                <organizationUrl>http://www.sindi.co.za</organizationUrl>
                <roles>
                    <role>DEVELOPER</role>
                </roles>
                <timezone>+2</timezone>
            </developer>
        </developers>

        <dependencyManagement>
            <dependencies>
                <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
                <dependency>
                    <groupId>javax.xml.bind</groupId>
                    <artifactId>jaxb-api</artifactId>
                    <version>${javax.jaxb-api.version}</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>javax</groupId>
                    <artifactId>jakarta-platform</artifactId>
                    <version>${jakarta.jakartaee-api.version}</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.weld.se</groupId>
                    <artifactId>weld-se-core</artifactId>
                    <version>${org.jboss.weld.se.core.version}</version>
                </dependency>
                <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
                <dependency>
                    <groupId>org.junit.jupiter</groupId>
                    <artifactId>junit-jupiter-api</artifactId>
                    <version>${junit-jupiter.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                    <version>${slf4j-log4j12.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>


        <dependencies>
            <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
            <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
            </dependency>

            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
            </dependency>

            <dependency>
                <groupId>org.jboss.weld.se</groupId>
                <artifactId>weld-se-core</artifactId>
            </dependency>

            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
            </dependency>
        </dependencies>

        <build>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>${version.maven-compiler-plugin}</version>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>${version.maven-enforcer-plugin}</version>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${version.maven-failsafe-plugin}</version>
                    </plugin>
                    <!-- This plugin is what Maven uses to call test cases -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${version.maven-surefire-plugin}</version>
                    </plugin>
                </plugins>
            </pluginManagement>

            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>enforce-maven</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>[${maven.version},)</version>
                                        <message>Check for Maven version &gt;=${maven.version} failed.
                                            Update your Maven install.</message>
                                    </requireMavenVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <configuration>
                        <systemPropertyVariables>
                            <http.port>${liberty.var.default.http.port}</http.port>
                        </systemPropertyVariables>
                    </configuration>
                    <executions>
                      <execution>
                        <id>integration-test</id>
                        <goals>
                          <goal>integration-test</goal>
                        </goals>
                        <configuration>
                          <trimStackTrace>false</trimStackTrace>
                        </configuration>
                      </execution>
                      <execution>
                        <id>verify</id>
                        <goals>
                          <goal>verify</goal>
                        </goals>
                      </execution>
                    </executions>
                </plugin>
                <!-- This plugin is what Maven uses to call test cases -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                </plugin>
            </plugins>
        </build>

    </project>
Enter fullscreen mode Exit fullscreen mode

The dependency is all that is required to be added to our pom file.

    <dependency>
        <groupId>javax</groupId>
        <artifactId>jakarta-platform</artifactId>
        <version>${jakarta.jakartaee-api.version}</version>
        <scope>provided</scope>
    </dependency>
Enter fullscreen mode Exit fullscreen mode

The scope dependency for Jakarta EE is marked as provided since the application containers already contain the implementations of the different Jakarta EE 8 specifications (thus we don't need to include the libraries in our project build).
This results in a so-called thin war of just some kilobytes and hence making deployment fast.

To ensure that your Jakarta EE 8 application runs as expected, you will need to deploy it on a Jakarta EE 8 compatible application container server. All Jakarta EE compatible application servers are listed on the following overview page.

And that's it! It's that simple and you're good to go. You can now write simple services that are tiny in nature, thus enabling rapid application testing and creating a quick deployment, saving you time, money and resources for better things.

Please do not forget to subscribe to this blog. In the next tutorial, I will discuss CDI, with simple working examples on how to tackle CDI in Jakarta EE 8.

Take care!

Top comments (0)