Giter Site home page Giter Site logo

hantsy / jakartaee9-servlet-starter-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
21.0 3.0 6.0 381 KB

A Jakarta EE starter project boilerplate for Jakarta Servlet 5.0 (aligned with Jakarta EE 9) Container

Home Page: https://itnext.io/building-jakarta-ee-9-web-application-with-servlet-containers-b3acc50c8464

License: Apache License 2.0

Java 95.00% HTML 5.00%
jakarta-ee servlet jetty tomcat cdi jsf json-b json bean-validation jakarta-persistence

jakartaee9-servlet-starter-boilerplate's Introduction

jakartaee9-servlet-starter-boilerplate

Compile and build it-tomcat it-jetty Quality Gate Status Coverage

Yeah, this is another starter boilerplate project for Jakarta EE (esp. Servlet/Java Web) developers.

This repository is a lightweight variant of the original Jakarta EE 9 starter boilerplate which allows you to run applications on a Servlet 5.0 compatible container, such as Apache Tomcat, Eclipse Jetty, JBoss Undertow.

Currently, the following features are added.

  • Jakarta REST 3.0(Jersey 3.0)
  • CDI 3.0 (Weld 4.0)
  • Jakarta Server Faces 3.0(Mojarra 3.0)
  • And transitive dependencies of above features, incuding Jakarta EL, Jarkarta Json Processing, Jakarta Json Binding, Jakarta Validation(Hibernate Validator), etc.

Nowadays the most popular Servlet containers, such as Apache Tomcat, Eclipse Jetty, etc. have built-in Jakarta Servlet, Jakarta Server Pages, JSTL, Jakarta EL and Jakarta WebSocket supports.

For full-fledged features support of Jakarta EE 9, please go to hantsy/jakartaee9-starter-boilerplate.

Build

Prerequisites

Assume you have installed the following essential software.

Apache Tomcat 10

Run the following command to run the application on Tomcat 10.

mvn clean package cargo:run

Eclipse Jetty 11

The new jetty-maven-plugin reorganizes the former run-fork goal and provides 3 modes to run a Jetty server.

  • EMBEDDED
  • FORKED
  • EXTERNAL

The default mode is EMBEDDED similar to the simplest jetty:run goal in the previous version.

The FORKED mode uses a forked thread to run the application.

The EXTERNAL mode runs the application on an external Jetty server.

This sample project provides configurations for EMBEDED and EXTERNAL mode.

There is a jetty-embed profile for EMBEDED mode and a jetty-external profile for EXTERNAL mode.

To run the application on EMBEDED mode, run the following command.

mvn clean jetty:run -Pjetty-embed

To run the application on EXTERNAL mode, firstly download a copy of the latest Eclipse Jetty 11 and set an environment variable JETTY_HOME to the location of the Jetty distribution.

Then run the following command.

mvn clean jetty:run -Pjetty-external

Testing

The testing codes write with JUnit and Arquillian.

Run the following command to execute tests against a Tomcat 10 Embedded adapter.

mvn clean verify -Parq-tomcat-embedded

Alternatively, run the following command to execute tests against a Jetty 11 Embedded adapter.

mvn clean verify -Parq-jetty-embedded

There is another arq-weld Maven profile with which you can run tests on a Weld embedded adapter.

mvn clean verify -Parq-weld

Note: The arq-weld is only used to test CDI components.

Resources

jakartaee9-servlet-starter-boilerplate's People

Contributors

dependabot[bot] avatar hantsy avatar olamy avatar tautastic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jakartaee9-servlet-starter-boilerplate's Issues

Run on Eclipse Jetty 11

Eclipse Jetty 11 adds Jakarta EE 9 alignment.

I have tried to run this simple application on Jetty via the official Jetty Maven plugin but failed.

See: https://www.eclipse.org/lists/jetty-users/msg09809.html

The newest jetty-maven-plugin describes 3 deployMode, embed(default), fork, external instead of former run, run-forked goals, etc, you can execute run and start goals on every mode.

I have tried embed and external mode, failed.

There is a jetty-external profile defined in the pom.xml, and enable cdi-decorate, when the application is started, all features of Servlet seems to get supported, it caused an exception at the startup.

See this question I posted in Jetty user mail list: https://www.eclipse.org/lists/jetty-users/msg09812.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.