Getting started with ZK-Jakarta"
Line 109: | Line 109: | ||
== Run on server through eclipse == | == Run on server through eclipse == | ||
+ | |||
+ | You can run in debug mode on a Tomcat server from eclipse by following the configuration shown in the [[ZK_Installation_Guide/Quick_Start/Create_and_Run_Your_First_ZK_Application_with_Eclipse_and_ZK_Studio | quick start with Eclipse and Tomcat ]] guide, while using a [http://tomcat.apache.org/whichversion.html | compatible tomcat version]. | ||
== Run on server and remotely debug with JPDA == | == Run on server and remotely debug with JPDA == |
Revision as of 11:18, 25 May 2021
This guide's purpose is to provide an easy-to-setup environment to develop a ZK application using ZK 9.6 and a Jakarta-compliant run environment in Eclipse.
Disclaimer
Please make sure that you are using the up-to-date versions of the softwares described in this example when installing yourself.
Environment setup
Please refer to the the eclipse and maven quick start guide environment setup.
Project configuration
This section details the configuration steps necessary to run your project in a servlet 5.0 context.
Maven dependencies configuration
ZK supports the Jakarta servlet configuration starting from ZK 9.6.0-jakarta. When updating your pom file, you need to include the -jakarta suffix in your dependencies version configuration:
<dependency>
<zk.version>9.6.0-jakarta</zk.version>
<!--<zk.version>9.6.0-jakarta-Eval</zk.version> -->
...
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zk</artifactId>
<version>${zk.version}</version>
</dependency>
For a more in-depth look at the pom.xml file configuration, please refer to the the Resolving ZK Framework Artifacts via Maven page .
If your project uses the servlet-API dependency, you will need to update your pom file to use the Jakarta servlet-API instead. See here for a list of available versions.
For example, you may need to replace
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
by
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
Java classes
If you have replaced the servlet-API dependency for you project, you will need to refactor Java classes which imports related classes.
For example, you may have a custom servlet implementing javax.servlet.Servlet, or you may be using the javax.servlet.http.HttpServletRequest
In this case you will need to replace these imports by the equivalent one from the Jakarta Servlet-API library. In most cases, the imported class will use the same name and package structure:
Original package | Migrated package |
---|---|
Javax.servlet | jakarta.servlet |
Javax.servlet.Servlet | jakarta.servlet.Servlet |
Javax.servlet.http.HttpServletRequest | jakarta.servlet.http.HttpServletRequest |
Etc. |
We recommend that you also refer to the update guide for your preferred run environment.
Version History
Version | Date | Content |
---|---|---|
1.0.0 | May 2021 | Documentation relative to ZK 9.6.0-Jakarta |
Running the project in debug mode
There are three approaches to running a project in debug mode in eclipse. Each of these cover a different approach.
Run from maven
Refer to the approach described in the eclipse and maven quick start guide.
When configuring your application's pom file, use a jetty version that supports servlet 5.0. For example, the 11.0.X version of the | jetty-maven-plugin supports this specification.
You can then start your project as a maven build, using Debug as... > Maven build... and declaring the jetty:run goal
Run on server through eclipse
You can run in debug mode on a Tomcat server from eclipse by following the configuration shown in the quick start with Eclipse and Tomcat guide, while using a | compatible tomcat version.
Run on server and remotely debug with JPDA