My project is this web app: https://nocodefunctions.com, open sourced here.
It runs on Payara Community Edition: Payara Micro 5.2022.4
I am moving it to JakartaEE 10 and JSF 3. JakartaEE 10 and Payara 6 (which runs on it) are so recent that NetBeans 15 does not manage them yet.
So I try to develop without NetBeans, directly from the CLI, which is something I am unfamiliar with. I think I can:
I am stuck at step 1:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project jsf-app: Compilation failure:
Compilation failure:
[ERROR] /C:/Users/levallois/open/no code app/webapp/jsf-app/src/main/java/net/clementlevallois/nocodeapp/web/front/importdata/DataImportBean.java:[286,21] cannot access javax.faces.event.FacesEvent
[ERROR] class file for javax.faces.event.FacesEvent not found
[ERROR] /C:/Users/levallois/open/no code app/webapp/jsf-app/src/main/java/net/clementlevallois/nocodeapp/web/front/functions/TopicsBean.java:[405,37] cannot access javax.faces.event.AjaxBehaviorEvent
[ERROR] class file for javax.faces.event.AjaxBehaviorEvent not found
I have found a couple of questions on SO that point to the same error, with answers by @BalusC, but I am still stuck.
the pom.xml
:
4.0.0
<groupId>net.clementlevallois.nocodeapp.webfront</groupId>
<artifactId>jsf-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Nocode webapp - jsf app</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<jakartaee>10.0.0</jakartaee>
<java.version>19</java.version>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.1.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>jakarta.faces</groupId>
<artifactId>jakarta.faces-api</artifactId>
<version>3.0.0</version>
<type>jar</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish/jakarta.faces -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.faces</artifactId>
<version>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.parsson/parsson -->
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<version>2.0.0</version>
</dependency>
<!--5Mb-->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>11.0.0</version>
</dependency>
<!--809kb-->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>4.0</version>
</dependency>
<!--8kb-->
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee}</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<release>19</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- <repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>-->
The relevant part of the faces-config.xml
:
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_3_0.xsd"
version="2.3">
</faces-config>
As of November 2022, Primefaces requires a "jakarta" classifier to make sure it pulls Jakarta dependencies, like so:
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>12.0.0</version>
<classifier>jakarta</classifier>
</dependency>